Install
openclaw skills install @hypnotronic3/gateway-watchdogMonitor an OpenClaw gateway, auto-restart on failure, and alert when recovery fails.
openclaw skills install @hypnotronic3/gateway-watchdogMonitor an OpenClaw gateway process. Auto-restart on failure (with configurable attempts and cooldown). Write status/alert JSON files for remote monitoring. Integrate with nginx for HTTP status endpoints and with a separate OpenClaw cron job for notifications.
Deploy on any Linux server running an OpenClaw gateway that should stay up automatically. Pair with a remote OpenClaw instance that checks the status endpoints and alerts you when recovery fails.
scripts/watchdog.py and scripts/watchdog.conf to your server (e.g. /opt/openclaw-watchdog/).watchdog.conf with your settings.scripts/openclaw-gateway-watchdog.service to /etc/systemd/system/.sudo systemctl daemon-reload
sudo systemctl enable openclaw-gateway-watchdog
sudo systemctl start openclaw-gateway-watchdog
references/nginx-snippet.conf to expose status endpoints.All settings are in scripts/watchdog.conf. Key options:
| Setting | Default | Description |
|---|---|---|
HEALTH_URL | http://127.0.0.1:18789/health | Gateway health endpoint |
CHECK_INTERVAL | 60 | Seconds between checks |
RESTART_COOLDOWN | 30 | Seconds to wait after restart before re-checking |
MAX_RESTART_ATTEMPTS | 3 | Restart attempts per failure cycle |
STATE_FILE | /opt/openclaw-watchdog/watchdog-state.json | Persistent state file path |
ALERT_FILE | /opt/openclaw-watchdog/watchdog-alert.json | Alert file path (written on critical failure) |
LOG_FILE | /var/log/openclaw-gateway-watchdog.log | Log file path |
GATEWAY_SERVICE | openclaw-gateway | systemd user service name to restart |
CHECK_INTERVAL seconds, curls the health endpoint.MAX_RESTART_ATTEMPTS).RESTART_COOLDOWN seconds then re-checks health.critical.healthy, resets counters.watchdog-state.json){
"status": "healthy|degraded|critical|starting",
"consecutive_failures": 0,
"restart_attempts": 0,
"total_restarts": 0,
"last_known_good": "2026-07-12T05:04:39.944168+00:00",
"last_failure_time": null
}
watchdog-alert.json)Only exists when status is critical. Deleted on recovery.
{
"severity": "critical",
"subject": "Gateway DOWN — Auto-Recovery Failed",
"message": "OpenClaw gateway down for X checks. Manual intervention required.",
"timestamp": "2026-07-12T05:10:00+00:00",
"gateway_url": "http://127.0.0.1:18789/health"
}
Set up a cron job on another machine's OpenClaw to check the status endpoint every 5 minutes and notify you on critical failures:
{
"name": "Server Gateway Health Check",
"schedule": { "kind": "every", "everyMs": 300000 },
"sessionTarget": "isolated",
"payload": {
"kind": "agentTurn",
"message": "Check the server gateway watchdog. Run: curl -sf http://YOUR_SERVER/watchdog/state.json and curl -sf http://YOUR_SERVER/watchdog/alert.json — if status is 'critical' or there's an alert, notify the user immediately."
},
"delivery": { "mode": "announce" }
}
LOG_FILE and ensure STATE_FILE directory is writable by the service user.systemctl --user restart GATEWAY_SERVICE. Check XDG_RUNTIME_DIR is set.www-data) if exposing via nginx.chmod 755 on parent directories, chmod 644 on JSON files).