41 lines
1.2 KiB
Batchfile
41 lines
1.2 KiB
Batchfile
@echo off
|
|
chcp 65001 >nul
|
|
echo === Stopping ProxyPool Services ===
|
|
echo.
|
|
|
|
set "BACKEND_PORT=18080"
|
|
set "FRONTEND_PORT=18081"
|
|
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.
|