OpenClaw Watchdog
A background watchdog for OpenClaw. It checks if your gateway is running, and restarts it if it stops responding.
What it does
- Pings the gateway every 60 seconds
- Counts consecutive failures
- After 3 failures in a row, runs
openclaw gateway restart - Logs all events to
/tmp/watchdog.log - Can run as a systemd service (survives reboots)
Trigger phrases
- "start watchdog"
- "is my agent online"
- "watchdog status"
- "check OpenClaw health"
- "keep OpenClaw running"
How to run
Start the watchdog: Just tell me "start watchdog" and I'll run it for you. No setup needed.
Check if it's running: Tell me "watchdog status" and I'll show you the last log entries and process state.
Check the logs:
Tell me "watchdog logs" and I'll tail the last entries from /tmp/watchdog.log.
Stop it: Tell me "stop watchdog".
How it works
Every 60 seconds, the watchdog checks:
- Is the gateway responding? → log "All clear"
- Is the gateway down? → increment failure counter
- 3 failures in a row? → restart the gateway and log the restart
Log format
2026-04-09 03:30:00 WATCHDOG: Watchdog started — monitoring every 60s
2026-04-09 03:30:00 WATCHDOG: All clear
2026-04-09 03:31:00 WATCHDOG: Check failed (1/3) — alive=True responding=False
2026-04-09 03:32:00 WATCHDOG: OPENCLAW DOWN — restarting gateway...
2026-04-09 03:32:30 WATCHDOG: Restart complete.
Who needs this
- If your OpenClaw gateway freezes or crashes frequently
- If you run OpenClaw on a VPS and can't monitor it 24/7
- If you want automatic recovery without manually restarting
Requirements
- Python 3.x
- OpenClaw gateway running on the same server
curlavailable for health checks
