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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
feat(install): add watchdog restart loop for Unraid agents
rcourtman2c4d7edf5802
diff --git a/scripts/install.sh b/scripts/install.shindex 229ef70ba5..870515295c 100755--- a/scripts/install.sh+++ b/scripts/install.sh@@ -937,6 +937,7 @@ if [[ -f /etc/unraid-version ]]; then#!/bin/bash# Pulse Agent startup script for Unraid# Auto-generated by Pulse installer+# Includes watchdog loop to restart agent on failure# Kill any existing pulse-agent processespkill -f "^${RUNTIME_BINARY}" 2>/dev/null || true@@ -948,10 +949,28 @@ sleep 2cp "${UNRAID_STORED_BINARY}" "${RUNTIME_BINARY}"chmod +x "${RUNTIME_BINARY}"-# Start the agent in the background-nohup ${RUNTIME_BINARY} ${EXEC_ARGS} >> /var/log/${AGENT_NAME}.log 2>&1 &+# Watchdog loop: restart agent if it exits+# Uses exponential backoff to prevent rapid restart loops+RESTART_DELAY=5+MAX_RESTART_DELAY=60++while true; do+ echo "\$(date '+%Y-%m-%d %H:%M:%S') [watchdog] Starting pulse-agent..." >> /var/log/${AGENT_NAME}.log+ ${RUNTIME_BINARY} ${EXEC_ARGS} >> /var/log/${AGENT_NAME}.log 2>&1+ EXIT_CODE=\$?++ echo "\$(date '+%Y-%m-%d %H:%M:%S') [watchdog] pulse-agent exited with code \$EXIT_CODE, restarting in \${RESTART_DELAY}s..." >> /var/log/${AGENT_NAME}.log+ sleep \$RESTART_DELAY++ # Exponential backoff (cap at MAX_RESTART_DELAY)+ RESTART_DELAY=\$((RESTART_DELAY * 2))+ if [ \$RESTART_DELAY -gt \$MAX_RESTART_DELAY ]; then+ RESTART_DELAY=\$MAX_RESTART_DELAY+ fi+doneEOF+# Add to /boot/config/go if not already presentGO_MARKER="# Pulse Agent"if [[ -f "$GO_SCRIPT" ]]; then@@ -974,9 +993,9 @@ EOFlog_info "Added startup entry to ${GO_SCRIPT}..."- # Start the agent now (use array for proper argument handling)- log_info "Starting agent..."- nohup "${RUNTIME_BINARY}" "${EXEC_ARGS_ARRAY[@]}" >> "/var/log/${AGENT_NAME}.log" 2>&1 &+ # Start the agent now using the wrapper script (includes watchdog)+ log_info "Starting agent with watchdog..."+ nohup bash "${WRAPPER_SCRIPT}" >> "/var/log/${AGENT_NAME}.log" 2>&1 &log_info "Installation complete!"log_info "The agent will start automatically on boot."