Files
ProxyPool/script/stop.bat
祀梦 df3cc87f88 fix(scripts): 修复 Windows 启动脚本兼容性和稳定性问题
- start.bat: 移除后端日志文件重定向,避免文件锁定导致启动失败

- start.bat: 用 ping 替代 timeout,修复 PowerShell 下错误

- start.bat: 健康检查改为 health 接口,提升可靠性

- start.bat: 修复前端 cd 路径带空格时的引号嵌套问题,使用 /B 在当前窗口后台运行

- stop.bat: 同样用 ping 替代 timeout 提升兼容性
2026-04-02 22:19:59 +08:00

41 lines
1.2 KiB
Batchfile

@echo off
chcp 65001 >nul
echo === Stopping ProxyPool Services ===
echo.
set "BACKEND_PORT=9949"
set "FRONTEND_PORT=9948"
set "STOPPED_COUNT=0"
echo [1/2] Stopping processes on ports %BACKEND_PORT% and %FRONTEND_PORT%...
REM Stop backend port
for /f "tokens=5" %%a in ('netstat -ano ^| findstr ":%BACKEND_PORT%" ^| findstr "LISTENING"') do (
for /f "tokens=1" %%b in ('tasklist /FI "PID eq %%a" ^| findstr "%%a"') do (
taskkill /F /PID %%a >nul 2>&1
echo Stopped port %BACKEND_PORT% (PID: %%a, Process: %%b)
set /a STOPPED_COUNT+=1
)
)
REM Stop frontend port
for /f "tokens=5" %%a in ('netstat -ano ^| findstr ":%FRONTEND_PORT%" ^| findstr "LISTENING"') do (
for /f "tokens=1" %%b in ('tasklist /FI "PID eq %%a" ^| findstr "%%a"') do (
taskkill /F /PID %%a >nul 2>&1
echo Stopped port %FRONTEND_PORT% (PID: %%a, Process: %%b)
set /a STOPPED_COUNT+=1
)
)
echo Stopped %STOPPED_COUNT% process(es)
echo.
echo [2/2] Waiting for processes to fully stop...
REM Use ping instead of timeout for PowerShell compatibility
ping -n 3 127.0.0.1 >nul 2>&1
echo.
echo === Done ===
echo All services have been stopped.
echo.