Spaces:
Running

MeloonTop / scripts /stop.sh
isold's picture
update
1ae349b
Raw History Blame Contribute Delete
893 Bytes
#!/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 "✅ 完成。"