Updated runserver.bat (#7206)

This commit is contained in:
Null il3ol2ed 2022-08-24 14:43:04 -06:00 committed by GitHub
parent a0eb9d5ee2
commit 44d3edf99d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@ echo "target=%target%"
REM to avoid any localization issue
set "login_running=false"
set "char_running=false"
set "web_running=false"
set "map_running=false"
@ -38,6 +39,7 @@ goto :EOF
echo "Stoping all serv"
call :stopLogin
call :stopChar
call :stopWeb
call :stopMap
goto :EOF
@ -47,6 +49,7 @@ echo "Starting all serv"
set "restart_mode=on"
call :startLogin
call :startChar
call :startWeb
call :startMap
goto :EOF
@ -55,6 +58,7 @@ echo "Starting all serv"
set "restart_mode=off"
call :startLogin
call :startChar
call :startWeb
call :startMap
goto :EOF
@ -62,12 +66,15 @@ goto :EOF
echo "Getting status of all serv"
call :getLoginStatus
call :getCharStatus
call :getWebStatus
call :getMapStatus
if "%login_running%" == "false" ( echo "login_serv is not running"
) else echo "login_serv is running pid=%LoginServPID%"
if "%char_running%" == "false" ( echo "char_serv is not running"
) else echo "char_serv is running pid=%CharServPID%"
if "%web_running%" == "false" ( echo "web_serv is not running"
) else echo "web_serv is running pid=%WebServPID%"
if "%map_running%" == "false" ( echo "map_serv is not running"
) else echo "map_serv is running pid=%MapServPID%"
@ -90,6 +97,11 @@ call :getCharStatus
if "%char_running%" == "true" Taskkill /PID %CharServPID% /F
goto :EOF
:stopWeb
call :getWebStatus
if "%web_running%" == "true" Taskkill /PID %WebServPID% /F
goto :EOF
:stopMap
call :getMapStatus
if "%map_running%" == "true" Taskkill /PID %MapServPID% /F
@ -108,6 +120,12 @@ if "%char_running%" == "false" ( start cmd /k charserv.bat %restart_mode%
) else echo "Char serv is already running, pid=%CharServPID%"
goto :EOF
:startWeb
call :getWebStatus
if "%web_running%" == "false" ( start cmd /k webserv.bat %restart_mode%
) else echo "Web serv is already running, pid=%WebServPID%"
goto :EOF
:startMap
call :getMapStatus
if "%map_running%" == "false" ( start cmd /k mapserv.bat %restart_mode%
@ -126,6 +144,11 @@ for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq char-server.exe"') do
echo(%CharServPID%|findstr "^[-][1-9][0-9]*$ ^[1-9][0-9]*$ ^0$">nul&& set "char_running=true" || set "char_running=false"
goto :EOF
:getWebStatus
for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq web-server.exe"') do set WebServPID=%%b
echo(%WebServPID%|findstr "^[-][1-9][0-9]*$ ^[1-9][0-9]*$ ^0$">nul&& set "Web_running=true" || set "web_running=false"
goto :EOF
:getMapStatus
for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq map-server.exe"') do set MapServPID=%%b
echo(%MapServPID%|findstr "^[-][1-9][0-9]*$ ^[1-9][0-9]*$ ^0$">nul&& set "map_running=true" || set "map_running=false"