From 5dfaa75a06d3baa78ad1d9b9e64fd0e148e35ea3 Mon Sep 17 00:00:00 2001 From: Aska Date: Tue, 8 Sep 2026 02:34:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(scripts):=20ctrl.sh=20restart=20=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E6=8C=82=E8=B5=B7=E8=B6=85=E6=97=B6=E2=80=94=E2=80=94?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=90=8E=20disown=20=E5=89=94=E9=99=A4?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=20job,=E8=84=9A=E6=9C=AC=E7=AB=8B=E5=8D=B3?= =?UTF-8?q?=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/ctrl.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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