From 7037a1d5d80585e03c3b09ed78601b08a1cd75ca Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 12 Sep 2026 18:22:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(deploy):=20restart=20=E8=84=9A=E6=9C=AC=20l?= =?UTF-8?q?sof=20=E5=8F=AA=E5=8F=96=20LISTEN=20=E6=80=81=E8=BF=9B=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2026-09-12 部署实测:lsof -ti tcp:PORT 返回该端口上所有 socket 的 进程——包括 BFF 到 8098/8094 的已建立连接,不只监听者。kill 多行 PID 时旧进程存活、新进程绑定失败静默退出(vstore 报 address already in use;生信 restart 后仍是旧进程)。改 -sTCP:LISTEN 只取监听者, kill 不再加引号(多 PID 需分词)。 Co-Authored-By: Claude Fable 5 --- bioflow_service/restart.sh | 4 ++-- vstore/vstore_restart.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bioflow_service/restart.sh b/bioflow_service/restart.sh index 687c1b8..49716ba 100755 --- a/bioflow_service/restart.sh +++ b/bioflow_service/restart.sh @@ -15,12 +15,12 @@ HOST="${BIOFLOW_BIND_HOST:-127.0.0.1}" APP_MODULE="app.main:app" PID="" if command -v lsof >/dev/null 2>&1; then - PID="$(lsof -ti tcp:"$PORT" 2>/dev/null || true)" + PID="$(lsof -ti tcp:"$PORT" -sTCP:LISTEN 2>/dev/null || true)" fi if [[ -n "$PID" ]]; then echo "[restart] 停止 8098 旧进程 pid=$PID" - kill "$PID" 2>/dev/null || true + kill $PID 2>/dev/null || true sleep 2 fi diff --git a/vstore/vstore_restart.sh b/vstore/vstore_restart.sh index 89fb630..3dd8338 100755 --- a/vstore/vstore_restart.sh +++ b/vstore/vstore_restart.sh @@ -17,8 +17,8 @@ HOST="${VSTORE_BIND_HOST:-127.0.0.1}" # 杀旧进程([v]store 正则技巧防 pkill 自匹配;端口优先精确) if command -v lsof >/dev/null 2>&1; then - OLD_PID="$(lsof -ti tcp:"$PORT" 2>/dev/null || true)" - [ -n "$OLD_PID" ] && kill "$OLD_PID" 2>/dev/null || true + OLD_PID="$(lsof -ti tcp:"$PORT" -sTCP:LISTEN 2>/dev/null || true)" + [ -n "$OLD_PID" ] && kill $OLD_PID 2>/dev/null || true else pkill -f "[v]store.api:app" 2>/dev/null || true fi