usr/bin/custom/watchdog-monitor aktualisiert
This commit is contained in:
@@ -43,22 +43,30 @@ update_watchdog_config() {
|
|||||||
done
|
done
|
||||||
log "Configured watchdog to ping: ${ip_array[*]}"
|
log "Configured watchdog to ping: ${ip_array[*]}"
|
||||||
|
|
||||||
# Restart watchdog service
|
# Attempt to restart watchdog service
|
||||||
if sudo systemctl restart watchdog; then
|
if ! sudo systemctl restart watchdog; then
|
||||||
log "Watchdog service restarted successfully."
|
log "Failed to restart watchdog service. Attempting to stop and start."
|
||||||
|
|
||||||
# Stop watchdog-monitor service
|
# Fallback: stop then start the service
|
||||||
if sudo systemctl stop watchdog-monitor; then
|
sudo systemctl stop watchdog
|
||||||
log "watchdog-monitor service stopped successfully."
|
if sudo systemctl start watchdog; then
|
||||||
|
log "Watchdog service started successfully after stop."
|
||||||
else
|
else
|
||||||
log "Failed to stop watchdog-monitor service."
|
log "Failed to start watchdog service after stop."
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0 # Successful restart
|
|
||||||
else
|
else
|
||||||
log "Failed to restart watchdog service."
|
log "Watchdog service restarted successfully."
|
||||||
return 1 # Failed restart
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Stop watchdog-monitor service if restart/start was successful
|
||||||
|
if sudo systemctl stop watchdog-monitor; then
|
||||||
|
log "watchdog-monitor service stopped successfully."
|
||||||
|
else
|
||||||
|
log "Failed to stop watchdog-monitor service."
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0 # Successful restart/start
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user