Files
PlantAI-rag-new/bioflow_service/restart.sh
T

32 lines
1.0 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# restart.sh —— BIOFLOW 服务重启脚本(8098;不触碰生产服务 8090/8091)。
# 零硬编码:venv/python/仓库路径全部从脚本位置推导或环境变量覆盖。
# 用法: restart.sh [python] [port]
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
PYTHON="${1:-$REPO_ROOT/../plantai-rag-new-venv/bin/python}"
PORT="${2:-8098}"
HOST="${BIOFLOW_BIND_HOST:-0.0.0.0}"
[[ -x "$PYTHON" ]] || { echo "Python not found: $PYTHON" >&2; exit 2; }
APP_MODULE="app.main:app"
PID=""
if command -v lsof >/dev/null 2>&1; then
PID="$(lsof -ti tcp:"$PORT" 2>/dev/null || true)"
fi
if [[ -n "$PID" ]]; then
echo "[restart] 停止 8098 旧进程 pid=$PID"
kill "$PID" 2>/dev/null || true
sleep 2
fi
cd "$SCRIPT_DIR"
echo "[restart] 启动生信服务 :$PORT($PYTHON)"
nohup "$PYTHON" -m uvicorn "$APP_MODULE" --host "$HOST" --port "$PORT" \
> "$SCRIPT_DIR/bioflow.log" 2>&1 &
echo "[restart] 完成;日志 bioflow_service/bioflow.log"