Spaces:
Running

File size: 893 Bytes
5724ee3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1ae349b
5724ee3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env bash
# ==============================================================================
# Meloon Workspace - 停止本地联调服务
# ==============================================================================

echo "🛑 正在停止本地联调端口 (3000, 3001, 3002)..."

for PORT in 3000 3001 3002; do
    PIDS=$(lsof -ti :$PORT 2>/dev/null || true)
    if [ -n "$PIDS" ]; then
        echo "   停止端口 $PORT (PID: $PIDS)"
        kill -9 $PIDS 2>/dev/null || true
    fi
done

if [ "$1" == "--all" ] || [ "$1" == "-a" ]; then
    echo "🛑 停止后端端口 (8000)..."
    BACKEND_PIDS=$(lsof -ti :8000 2>/dev/null || true)
    if [ -n "$BACKEND_PIDS" ]; then
        echo "   停止后端 (PID: $BACKEND_PIDS)"
        kill -9 $BACKEND_PIDS 2>/dev/null || true
    fi
fi

rm -f "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/.dev_pids"
echo "✅ 完成。"