summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhaoyuren <13851610112@163.com>2026-03-29 15:19:22 -0500
committerhaoyuren <13851610112@163.com>2026-03-29 15:19:22 -0500
commit045f530cfbd2110e768ea68fbadb99c98da3fbbd (patch)
treee11960501747bbe1ec47b9415dbbc9dfb7990d7d
parent992afc3a6ffe1109b346b2074243cf2b4cbac0c7 (diff)
Graceful fallback when cron is unavailable
-rwxr-xr-xsetup.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/setup.sh b/setup.sh
index 2596284..1a46906 100755
--- a/setup.sh
+++ b/setup.sh
@@ -129,8 +129,11 @@ export CLAUDE_BRIDGE_DIR="$BRIDGE_DIR"
# 添加 cron(去重)
CRON_CMD="CLAUDE_BRIDGE_DIR=$BRIDGE_DIR $BRIDGE_DIR/cron_runner.sh"
-(crontab -l 2>/dev/null | grep -v claude-bridge; echo "* * * * * $CRON_CMD") | crontab -
-echo " cron 已配置 (每15秒轮询 + 自动重启)"
+if (crontab -l 2>/dev/null | grep -v claude-bridge; echo "* * * * * $CRON_CMD") | crontab - 2>/dev/null; then
+ echo " cron 已配置 (每15秒轮询 + 自动重启)"
+else
+ echo " ⚠️ cron 不可用,跳过。worker 依赖 hook 心跳,掉线会 Telegram 通知你手动重启。"
+fi
# === 6. 部署 CLAUDE.md ===
echo "[6/7] 部署 CLAUDE.md..."