Files
my-project/tools/xiufu_openclaw1.sh
T

33 lines
978 B
Bash
Executable File

#!/bin/bash
echo "=== OpenClaw快速修复 ==="
openclaw doctor --fix
# 1. 清理锁文件
echo "清理锁文件..."
find /root/.openclaw -name "*.lock" -delete 2>/dev/null
LOCK_COUNT=$(find /root/.openclaw -name "*.lock" 2>/dev/null | wc -l)
echo "剩余锁文件: $LOCK_COUNT"
# 2. 重启网关
echo "重启网关..."
openclaw gateway stop 2>/dev/null || true
sleep 2
openclaw gateway --force > /tmp/openclaw_restart.log 2>&1 &
# 3. 等待启动
echo "等待启动..."
for i in {1..10}; do
if curl -s http://localhost:18789/ > /dev/null 2>&1; then
echo "✅ 第${i}秒: 网关启动成功"
break
fi
echo "⏳ 第${i}秒: 启动中..."
sleep 1
done
# 4. 测试
echo "测试对话..."
openclaw agent --to "fix_test_$(date +%s)" --message "你刚刚从无法运行中被我手动恢复,所以你之前的操作可能导致了灾难的后果,现在停止一切对你身体的修改和任务。" --local --timeout 20
echo "修复完成!"