diff --git a/scripts/ctrl.sh b/scripts/ctrl.sh index 8eb34a7..cb78553 100644 --- a/scripts/ctrl.sh +++ b/scripts/ctrl.sh @@ -62,7 +62,11 @@ start() { fi [ -x "$APP_BIN" ] || { echo "未找到二进制 $APP_BIN,请先 go build"; return 1; } echo "启动 cyrene → $APP_BIN (端口 $GW_PORT)" - ( cd "$REPO" && setsid nohup "$APP_BIN" > "$LOG_FILE" 2>&1 < /dev/null & ) + # setsid 只脱离会话,但 cyrene 仍是本 bash 的后台 job;脚本退出时 bash 会等待 + # 它结束,导致 restart 命令"挂起超时"。disown 把它从作业表剔除,脚本立即返回。 + cd "$REPO" || return 1 + setsid nohup "$APP_BIN" > "$LOG_FILE" 2>&1 < /dev/null & + disown # 等待健康 local i for i in $(seq 1 20); do