From 011c1faad4b4d87a25051d6ce7bff405d6686f1c Mon Sep 17 00:00:00 2001 From: hotyue <52734432+hotyue@users.noreply.github.com> Date: Mon, 20 Apr 2026 16:46:45 +0000 Subject: [PATCH] =?UTF-8?q?fix(core):=20=E7=A7=BB=E9=99=A4=20agent=5Fdaemo?= =?UTF-8?q?n.sh=20=E5=B0=BE=E9=83=A8=E7=9A=84=20nohup=20=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E9=80=82=E9=85=8D=20Systemd=20Type?= =?UTF-8?q?=3Dsimple=20=E7=9A=84=E5=89=8D=E5=8F=B0=E9=98=BB=E5=A1=9E?= =?UTF-8?q?=E7=9B=91=E5=90=AC=EF=BC=8C=E4=BF=AE=E5=A4=8D=20cgroup=20?= =?UTF-8?q?=E8=AF=AF=E6=9D=80=E5=AF=BC=E8=87=B4=E7=9A=84=E6=97=A0=E9=99=90?= =?UTF-8?q?=E9=87=8D=E5=90=AF=E6=AD=BB=E5=BE=AA=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/agent_daemon.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/agent_daemon.sh b/core/agent_daemon.sh index 8714294..ff7e13d 100755 --- a/core/agent_daemon.sh +++ b/core/agent_daemon.sh @@ -407,8 +407,8 @@ except Exception as e: # ==================================================================================== EOF -# --- [重点升级 3: 真正的静默后台启动] --- -echo "🚀 [Agent] 正在后台启动 Webhook 监听服务 (端口: $AGENT_PORT)..." -nohup python3 "${INSTALL_DIR}/core/webhook.py" "$AGENT_PORT" > /dev/null 2>&1 & -disown 2>/dev/null || true -echo "✅ [Agent] 守护进程启动完毕,可安全关闭终端。" \ No newline at end of file +# --- [重点升级 3: 移交系统级守护进程接管] --- +echo "🚀 [Agent] 正在启动 Webhook 监听服务 (端口: $AGENT_PORT)..." +# 去掉 nohup 和 &,使用 exec 让 Python 进程直接替换当前 Bash 进程,前台阻塞运行 +# 这样 Systemd 才能真正捕捉到 Python 进程的生命周期,永不误杀! +exec python3 "${INSTALL_DIR}/core/webhook.py" "$AGENT_PORT" \ No newline at end of file