better startup scripts

This commit is contained in:
2026-03-04 18:05:50 +00:00
parent 98a6a69477
commit ba36629cdc
3 changed files with 222 additions and 124 deletions
+10 -9
View File
@@ -36,11 +36,6 @@ echo ""
echo "── PTY Sidecar (systemd service) ──"
echo " Node: $NODE_BIN ($("$NODE_BIN" -v))"
if systemctl is-active --quiet "$SERVICE_NAME" 2>/dev/null; then
skip "$SERVICE_NAME service already running"
exit 0
fi
sudo tee "$SERVICE_FILE" > /dev/null << EOF
[Unit]
Description=Officer PTY Sidecar
@@ -60,10 +55,16 @@ WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now "$SERVICE_NAME"
sudo systemctl enable "$SERVICE_NAME"
if systemctl is-active --quiet "$SERVICE_NAME"; then
ok "$SERVICE_NAME service installed and running"
if systemctl is-active --quiet "$SERVICE_NAME" 2>/dev/null; then
sudo systemctl restart "$SERVICE_NAME"
ok "$SERVICE_NAME service updated and restarted"
else
warn "$SERVICE_NAME service failed to start — check 'journalctl -u $SERVICE_NAME'"
sudo systemctl start "$SERVICE_NAME"
if systemctl is-active --quiet "$SERVICE_NAME"; then
ok "$SERVICE_NAME service installed and running"
else
warn "$SERVICE_NAME service failed to start — check 'journalctl -u $SERVICE_NAME'"
fi
fi