Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix(sensor-proxy): eliminate race in migration script

rcourtman5c2379b4b453
diff --git a/scripts/migrate-sensor-proxy-control-plane.sh b/scripts/migrate-sensor-proxy-control-plane.sh
index 7fffe0703e..49fe10d87f 100644
--- a/scripts/migrate-sensor-proxy-control-plane.sh
+++ b/scripts/migrate-sensor-proxy-control-plane.sh
@@ -148,12 +148,22 @@ EOF
chown pulse-sensor-proxy:pulse-sensor-proxy "$CONFIG_FILE" 2>/dev/null || true
}
+log "Stopping service to prevent config file races..."
+if systemctl is-active --quiet pulse-sensor-proxy; then
+ systemctl stop pulse-sensor-proxy
+ SERVICE_WAS_RUNNING=true
+else
+ SERVICE_WAS_RUNNING=false
+fi
+
log "Updating config..."
update_config_atomically
-if [[ "$SKIP_RESTART" == false ]]; then
- log "Restarting pulse-sensor-proxy..."
- systemctl restart pulse-sensor-proxy
+if [[ "$SKIP_RESTART" == false ]] && [[ "$SERVICE_WAS_RUNNING" == true ]]; then
+ log "Starting pulse-sensor-proxy..."
+ systemctl start pulse-sensor-proxy
+elif [[ "$SERVICE_WAS_RUNNING" == false ]]; then
+ log "Service was not running; leaving stopped"
else
warn "Skipping service restart; control-plane sync will start on next restart"
fi