Gateway Watchdog Lite
Overview
The gateway-watchdog-lite skill installs a macOS LaunchAgent or Linux systemd user service that monitors the OpenClaw gateway every 2 minutes. If the gateway is unresponsive, it automatically runs the recovery sequence and alerts via Telegram.
Supported platforms:
- - macOS (LaunchAgent) — INLINECODE0
- Linux (systemd user service) — INLINECODE1
What It Does
| Feature | Detail |
|---|
| Probe interval | Every 120 seconds |
| Health check |
HTTP probe to
127.0.0.1:<OC_PORT> — accepts 200, 301, 302 |
| Auto-recovery |
launchctl bootout +
launchctl bootstrap (macOS) /
systemctl restart (Linux) |
| Cooldown | 5 minutes between recovery attempts (anti-thrash) |
| Alerts | Telegram via
gog telegram send — success and failure |
| Logs |
/tmp/openclaw/gateway-watchdog.log |
Want crash loop detection + auto-mitigation? Upgrade to the full Gateway Watchdog skill (paid, from confuseduser.com).
Install
macOS
CODEBLOCK0
To disable Telegram alerts:
WORKSPACE_PATH=/your/workspace OC_PORT=18789 TELEGRAM_ID="" bash scripts/install.sh
| Variable | Required | Description | How to find it |
|---|
| INLINECODE8 | ✅ | Path to your OpenClaw workspace root | Run INLINECODE9 |
| INLINECODE10 |
✅ | Gateway port to probe (default: 18789) | Run
openclaw status |
|
TELEGRAM_ID | ⬜ Optional | Your Telegram user ID | Message
@userinfobot on Telegram |
Linux
CODEBLOCK2
Verify (macOS)
CODEBLOCK3
Verify (Linux)
CODEBLOCK4
Logs
CODEBLOCK5
Manual Trigger
Test the watchdog immediately:
CODEBLOCK6
Reset cooldown first if testing recovery:
CODEBLOCK7
Uninstall
macOS
CODEBLOCK8
Linux
CODEBLOCK9
Recovery Gotchas
See references/gotchas.md for OC-specific recovery notes including:
- - GGML Metal crash on restart — add
GGML_NO_METAL=1 to env vars openclaw gateway install --force — use after config changes- Bootout + bootstrap sequence — the correct recovery pattern
- Cooldown logic — 5 min between attempts, reset with INLINECODE17
- Telegram alert failures — won't block recovery (uses
|| true)
技能名称: gateway-watchdog-lite
详细描述:
Gateway Watchdog Lite
概述
gateway-watchdog-lite 技能会安装一个 macOS LaunchAgent 或 Linux systemd 用户服务,每 2 分钟监控 OpenClaw 网关。如果网关无响应,它会自动执行恢复序列并通过 Telegram 发送警报。
支持的平台:
- - macOS (LaunchAgent) — scripts/install.sh
- Linux (systemd 用户服务) — scripts/install-linux.sh
功能说明
向 127.0.0.1:
发送 HTTP 探测 — 接受 200、301、302 状态码 |
| 自动恢复 | launchctl bootout + launchctl bootstrap (macOS) / systemctl restart (Linux) |
| 冷却时间 | 恢复尝试间隔 5 分钟(防抖动) |
| 警报 | 通过 gog telegram send 发送 Telegram 消息 — 成功与失败均通知 |
| 日志 | /tmp/openclaw/gateway-watchdog.log |
需要崩溃循环检测 + 自动缓解功能? 升级到完整的 Gateway Watchdog 技能(付费版,来自 confuseduser.com)。
安装
macOS
bash
WORKSPACEPATH=/your/workspace OCPORT=18789 TELEGRAMID=yourid bash scripts/install.sh
禁用 Telegram 警报:
bash
WORKSPACEPATH=/your/workspace OCPORT=18789 TELEGRAM_ID= bash scripts/install.sh
| 变量 | 必填 | 描述 | 查找方法 |
|---|
| WORKSPACEPATH | ✅ | OpenClaw 工作区根目录路径 | 运行 openclaw status |
| OCPORT |
✅ | 要探测的网关端口(默认: 18789) | 运行 openclaw status |
| TELEGRAM_ID | ⬜ 可选 | 您的 Telegram 用户 ID | 在 Telegram 中向 @userinfobot 发送消息 |
Linux
bash
WORKSPACEPATH=/your/workspace OCPORT=18789 TELEGRAMID=yourid bash scripts/install-linux.sh
验证 (macOS)
bash
launchctl list | grep watchdog
验证 (Linux)
bash
systemctl --user status gateway-watchdog
日志
bash
tail -f /tmp/openclaw/gateway-watchdog.log
手动触发
立即测试看门狗:
bash
bash scripts/gateway-watchdog.sh
如果测试恢复功能,请先重置冷却时间:
bash
rm -f /tmp/openclaw/watchdog-last-recovery
bash scripts/gateway-watchdog.sh
卸载
macOS
bash
launchctl bootout gui/$UID/ai.openclaw.gateway-watchdog
rm ~/Library/LaunchAgents/ai.openclaw.gateway-watchdog.plist
Linux
bash
systemctl --user stop gateway-watchdog
systemctl --user disable gateway-watchdog
rm ~/.config/systemd/user/gateway-watchdog.service
systemctl --user daemon-reload
恢复注意事项
请参阅 references/gotchas.md 了解 OC 特定的恢复说明,包括:
- - 重启时的 GGML Metal 崩溃 — 在环境变量中添加 GGMLNOMETAL=1
- openclaw gateway install --force — 在配置更改后使用
- Bootout + bootstrap 序列 — 正确的恢复模式
- 冷却逻辑 — 尝试间隔 5 分钟,使用 rm /tmp/openclaw/watchdog-last-recovery 重置
- Telegram 警报失败 — 不会阻止恢复(使用 || true)