Gateway Auto-Fix Skill
Overview
This skill automatically monitors the OpenClaw gateway and fixes it when the RPC probe fails. It uses OpenClaw's built-in cron system for scheduling.
What It Does
- 1. Checks
openclaw gateway status every minute - Detects "RPC probe: failed" in the output
- Automatically runs:
-
openclaw doctor --fix to fix config issues
-
openclaw gateway restart to restart the gateway
- 4. Logs all actions to INLINECODE3
Quick Install (Automatic)
CODEBLOCK0
That's it! The skill will:
- - ✅ Add OpenClaw cron job (every 1 minute)
- ✅ Create the script
- ✅ Start monitoring
Manual Install (If ClawHub Not Available)
CODEBLOCK1
Manual Uninstall
CODEBLOCK2
Usage
Check Cron Status
CODEBLOCK3
Check Logs
CODEBLOCK4
Run Manually
CODEBLOCK5
Troubleshooting
Check if cron is running:
CODEBLOCK6
Check gateway:
CODEBLOCK7
Run manually:
CODEBLOCK8
Files Created
- - Script: INLINECODE4
- Log: INLINECODE5
- Cron: OpenClaw built-in (every 1 minute)
Configuration
Change Interval
CODEBLOCK9
Complete Manual Setup Commands
CODEBLOCK10
技能名称: gateway-auto-fix
详细描述:
网关自动修复技能
概述
该技能自动监控 OpenClaw 网关,并在 RPC 探测失败时进行修复。它使用 OpenClaw 内置的定时任务系统进行调度。
功能说明
- 1. 每分钟检查 openclaw gateway status
- 检测输出中是否包含 RPC probe: failed
- 自动执行:
- openclaw doctor --fix 修复配置问题
- openclaw gateway restart 重启网关
- 4. 将所有操作记录到 /tmp/openclaw-auto-fix.log
快速安装(自动)
bash
npx clawhub install gateway-auto-fix
安装完成!该技能将:
- - ✅ 添加 OpenClaw 定时任务(每1分钟)
- ✅ 创建脚本
- ✅ 开始监控
手动安装(如无法使用 ClawHub)
bash
1. 将脚本复制到工作空间
mkdir -p ~/.openclaw-it/workspace
cp /path/to/gateway-auto-fix/openclaw-auto-fix.sh ~/.openclaw-it/workspace/
2. 赋予执行权限
chmod +x ~/.openclaw-it/workspace/openclaw-auto-fix.sh
3. 添加 OpenClaw 定时任务
openclaw cron add \
--name gateway-auto-fix \
--every 1m \
--message Run: ~/.openclaw-it/workspace/openclaw-auto-fix.sh \
--no-deliver
手动卸载
bash
移除定时任务
openclaw cron rm gateway-auto-fix
删除脚本
rm ~/.openclaw-it/workspace/openclaw-auto-fix.sh
使用方法
检查定时任务状态
bash
openclaw cron list
openclaw cron status
查看日志
bash
tail -f /tmp/openclaw-auto-fix.log
手动运行
bash
~/.openclaw-it/workspace/openclaw-auto-fix.sh
或通过 OpenClaw 定时任务
openclaw cron run gateway-auto-fix
故障排除
检查定时任务是否运行:
bash
openclaw cron status
检查网关:
bash
openclaw gateway status
手动运行:
bash
openclaw cron run gateway-auto-fix
创建的文件
- - 脚本:~/.openclaw-it/workspace/openclaw-auto-fix.sh
- 日志:/tmp/openclaw-auto-fix.log
- 定时任务:OpenClaw 内置(每1分钟)
配置
更改执行间隔
bash
移除旧任务
openclaw cron rm gateway-auto-fix
添加新任务,设置不同间隔(例如5分钟)
openclaw cron add \
--name gateway-auto-fix \
--every 5m \
--message Run: ~/.openclaw-it/workspace/openclaw-auto-fix.sh \
--no-deliver
完整手动设置命令
bash
步骤1:创建工作空间
mkdir -p ~/.openclaw-it/workspace
步骤2:创建脚本
cat > ~/.openclaw-it/workspace/openclaw-auto-fix.sh << EOF
#!/bin/bash
LOG_FILE=/tmp/openclaw-auto-fix.log
echo === $(date) === >> $LOG_FILE
STATUS_OUTPUT=$(openclaw gateway status 2>&1)
echo $STATUS
OUTPUT >> $LOGFILE
if echo $STATUS_OUTPUT | grep -q RPC probe: failed; then
echo RPC 探测失败!正在运行自动修复... >> $LOG_FILE
openclaw doctor --fix 2>&1 >> $LOG_FILE
openclaw gateway restart 2>&1 >> $LOG_FILE
echo 自动修复完成于 $(date) >> $LOG_FILE
else
echo 网关运行正常 >> $LOG_FILE
fi
echo --- >> $LOG_FILE
EOF
步骤3:赋予执行权限
chmod +x ~/.openclaw-it/workspace/openclaw-auto-fix.sh
步骤4:添加 OpenClaw 定时任务
openclaw cron add \
--name gateway-auto-fix \
--every 1m \
--message Run: ~/.openclaw-it/workspace/openclaw-auto-fix.sh \
--no-deliver
步骤5:验证
openclaw cron list