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