fix: ethend.bat 启动时统一走端口检测+Y/n交互
This commit is contained in:
+2
-10
@@ -117,16 +117,7 @@ if %DO_FRESH%==1 (
|
||||
curl -s -X POST "http://localhost:%ETHEND_PORT%/api/services/start-all-fresh" >nul 2>&1
|
||||
)
|
||||
|
||||
:: Check if already running
|
||||
curl -s -o nul "http://localhost:%ETHEND_PORT%/api/health" 2>nul
|
||||
if %ERRORLEVEL%==0 (
|
||||
echo.
|
||||
echo [OK] ethend already running: http://localhost:%ETHEND_PORT%
|
||||
echo API: http://localhost:%ETHEND_PORT%/api/health
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
:: Check port conflict
|
||||
:: Check if port already in use
|
||||
set FOUND_PID=
|
||||
for /f "tokens=5" %%a in ('netstat -ano ^| findstr /R ":%ETHEND_PORT% " ^| findstr "LISTENING"') do set FOUND_PID=%%a
|
||||
if not "%FOUND_PID%"=="" (
|
||||
@@ -135,6 +126,7 @@ if not "%FOUND_PID%"=="" (
|
||||
set /p CHOICE="Kill old process and restart? [Y/n]: "
|
||||
if /i "!CHOICE!"=="n" (
|
||||
echo [INFO] Aborted by user.
|
||||
pause
|
||||
exit /b 0
|
||||
)
|
||||
echo [INFO] Killing PID %FOUND_PID%...
|
||||
|
||||
Reference in New Issue
Block a user