Blame view

scripts/stop.sh 1.15 KB
e7f2b240   tangwang   first commit
1
2
3
  #!/usr/bin/env bash
  # =============================================================================
  # OmniShopAgent - 停止脚本
8810a6fa   tangwang   重构
4
  # 停止 Streamlit 进程
e7f2b240   tangwang   first commit
5
6
7
8
9
  # =============================================================================
  set -euo pipefail
  
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
8810a6fa   tangwang   重构
10
  STREAMLIT_PORT="${STREAMLIT_PORT:-6008}"
e7f2b240   tangwang   first commit
11
12
13
14
15
16
  
  echo "=========================================="
  echo "OmniShopAgent 停止"
  echo "=========================================="
  
  # 1. 停止 Streamlit 进程
8810a6fa   tangwang   重构
17
  echo "[1/1] 停止 Streamlit..."
e7f2b240   tangwang   first commit
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  if pgrep -f "streamlit run app.py" >/dev/null 2>&1; then
      pkill -f "streamlit run app.py" 2>/dev/null || true
      echo "  Streamlit 已停止"
  else
      echo "  Streamlit 未在运行"
  fi
  
  # 按端口查找并终止
  if command -v lsof &>/dev/null; then
      PID=$(lsof -ti:$STREAMLIT_PORT 2>/dev/null || true)
      if [ -n "$PID" ]; then
          kill $PID 2>/dev/null || true
          echo "  已终止端口 $STREAMLIT_PORT 上的进程"
      fi
  fi
  
e7f2b240   tangwang   first commit
34
35
36
  echo "=========================================="
  echo "OmniShopAgent 已停止"
  echo "=========================================="