Advertisement
TinGieter

Dayz SA Server loader for Tomato, with auto restart.

Dec 15th, 2018
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.87 KB | None | 0 0
  1. @echo off
  2. C:\Windows\System32\mode con cols=51 lines=5 >nul
  3. cls
  4. color 0a
  5. set /a varA=0
  6. set /a varB=0
  7. set watch=DayZ SA Server
  8. title %watch% Auto Restart / Process Monitor
  9.  
  10. set profiles=ServerProfile
  11. set mods=DayZ-SA-Tomato;
  12.  
  13. :start
  14. REM // How long until auto restart?
  15. set hours="4"
  16. set minutes="0"
  17. set seconds="0"
  18.  
  19. REM // Launch parameters.
  20. start "Dayz Server" /high "DayZServer_x64.exe" -config=serverDZ.cfg -port=2302 -profiles=%profiles% -adminlog -freezecheck -scriptDebug=true -cpuCount=4 "-mod=%mods%" -scrAllowFileWrite -filePatching
  21.  
  22. REM // You do not need to update anything else below this line.
  23. for /f "delims=" %%G IN ('powershell "(get-date %time%).AddHours(%hours%).AddMinutes(%minutes%).AddSeconds(%seconds%).ToString('yyyyMMddHHmmss')"') do set endtime=%%G
  24. for /f "delims=" %%G IN ('powershell "(get-date %time%).ToString('HH:mm:ss')"') do set nowtimeclean=%%G
  25. for /f "delims=" %%G IN ('powershell "(get-date %time%).AddHours(%hours%).AddMinutes(%minutes%).AddSeconds(%seconds%).ToString('HH:mm:ss')"') do set endtimeclean=%%G
  26.  
  27. cls
  28. color 0a
  29. echo %time% - %watch% started at %nowtimeclean%
  30. echo %time% - and will restart at %endtimeclean%
  31. echo.
  32. echo %time% - Restarts: %varB%. Crashes: %VarA%.
  33.  
  34. :checkdayz
  35. for /f "delims=" %%G IN ('powershell "(get-date %time%).ToString('yyyyMMddHHmmss')"') do set nowtime=%%G
  36. if "%nowtime%" gtr "%endtime%" (
  37.     set /a varB+=1
  38.     cls
  39.     color 0e
  40.     echo %time% - Time is up.
  41.     echo %time% - Restarting %watch%!
  42.     goto restartdayz
  43. )
  44. tasklist /FI "IMAGENAME eq DayZServer_x64.exe" 2>NUL | find /I /N "DayZServer_x64.exe">NUL
  45. if "%ERRORLEVEL%"=="1" (
  46.     set /a varA+=1
  47.     cls
  48.     color 0c
  49.     echo %time% - %watch% closed or crashed.
  50.     echo %time% - Restarting %watch%!
  51.     goto restartdayz
  52. )
  53. TIMEOUT /T 3 /NOBREAK >NUL
  54. goto checkdayz
  55.  
  56. :restartdayz
  57. START taskkill /f /im DayZServer_x64.exe 2>nul
  58. TIMEOUT /T 3 /NOBREAK >NUL
  59. goto start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement