启动FK游戏服务器的批处理文件。


echo 开始运行FreeKnight服务器自检系统>d:\LogList.txt

tasklist /nh>d:\LogList.txt

echo [=============================================]>>d:\LogList.txt



:Lable

set process_file="d:\process_number.txt"

set process_num=4

set single_process_num=1



set p1=gamegateway.exe

tasklist /fi "imagename eq %p1%" 2>nul | findstr /i %p1% | find /c /v "">%process_file%

set /p i1=< %process_file%

if %i1% lss %process_num% goto Reload



set p2=GameSvr.exe

tasklist /fi "imagename eq %p2%" 2>nul | findstr /i %p2% | find /c /v "">%process_file%

set /p i2=< %process_file%

if %i2% lss %process_num% goto Reload



set p3=dbsvr.exe

tasklist /fi "imagename eq %p3%" 2>nul | findstr /i %p3% | find /c /v "">%process_file%

set /p i3=< %process_file%

if %i3% lss %single_process_num% goto Reload



set p4=logingateway.exe

tasklist /fi "imagename eq %p4%" 2>nul | findstr /i %p4% | find /c /v "">%process_file%

set /p i4=< %process_file%

if %i4% lss %single_process_num% goto Reload



set p5=loginsvr.exe

tasklist /fi "imagename eq %p5%" 2>nul | findstr /i %p5% | find /c /v "">%process_file%

set /p i5=< %process_file%

if %i5% lss %single_process_num% goto Reload



set p6=SuperGameSvr.exe

tasklist /fi "imagename eq %p6%" 2>nul | findstr /i %p6% | find /c /v "">%process_file%

set /p i6=< %process_file%

if %i6% lss %single_process_num% goto Reload



set p7=logsvr.exe

tasklist /fi "imagename eq %p7%" 2>nul | findstr /i %p7% | find /c /v "">%process_file%

set /p i7=< %process_file%

if %i7% lss %single_process_num% goto Reload



set p8=checknamesvr.exe

tasklist /fi "imagename eq %p8%" 2>nul | findstr /i %p8% | find /c /v "">%process_file%

set /p i8=< %process_file%

if %i8% lss %single_process_num% goto Reload



ping -n 10 127.1 >nul 2>nul



goto Lable



:Reload

   set hour=%time:~,2%

   if "%time:~,1%"==" " set hour=0%time:~1,1%

   echo %date:~0,4%%date:~5,2%%date:~8,2%%hour%%time:~3,2%%time:~6,2%>d:\LogList.txt

   echo 部分服务器不存在,即将关闭全部服务器并重新启动>>d:\LogList.txt



   taskkill /F /im  "logingateway.exe"

   ping -n 5 127.1 >nul 2>nul

   taskkill /F /im  "loginsvr.exe"

   ping -n 5 127.1 >nul 2>nul

   taskkill /F /im  "gamegateway.exe"

   ping -n 180 127.1 >nul 2>nul



   taskkill /F /im  "dbsvr.exe"

   ping -n 5 127.1 >nul 2>nul

   taskkill /F /im  "GameSvr.exe"

   ping -n 5 127.1 >nul 2>nul

   taskkill /F /im  "SuperGameSvr.exe"

   ping -n 5 127.1 >nul 2>nul

   taskkill /f /im  "logsvr.exe"

   ping -n 5 127.1 >nul 2>nul

   taskkill /f /im  "checknamesvr.exe"

   ping -n 30 127.1 >nul 2>nul





   start "" "checknamesvr"

   ping -n 2 127.1 >nul 2>nul

   start "" "dbsvr"

   ping -n 2 127.1 >nul 2>nul

   start "" "gamegateway"

   ping -n 2 127.1 >nul 2>nul

   start "" "GameSvr"

   ping -n 2 127.1 >nul 2>nul

   start "" "logingateway"

   ping -n 2 127.1 >nul 2>nul

   start "" "loginsvr"

   ping -n 2 127.1 >nul 2>nul

   start "" "logsvr"

   ping -n 2 127.1 >nul 2>nul

   start "" "superGameSvr"

   ping -n 2 127.1 >nul 2>nul

   start "" "gamegateway" gamegateway1301

   ping -n 2 127.1 >nul 2>nul

   start "" "GameSvr" game301

   ping -n 2 127.1 >nul 2>nul

   start "" "gamegateway" gamegateway1302

   ping -n 2 127.1 >nul 2>nul

   start "" "GameSvr" game302

   ping -n 2 127.1 >nul 2>nul

   start "" "gamegateway" gamegateway1303

   ping -n 2 127.1 >nul 2>nul

   start "" "GameSvr" game303





   ping -n 20 127.1 >nul 2>nul

goto Lable