Advertisement
tinboye

servermonitor.bat

Mar 23rd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. @echo off
  2. ::
  3. ::Set Name of Server, the same as what you placed in server_start.bat
  4. set "_servername=Name of Server"
  5. ::
  6. ::Add a \ at the end of path!
  7. set "_armaserverpath=D:\Games\Servers\epoch\"
  8. ::
  9. ::Set the time that monitor will check to see if server is down, in seconds
  10. set "_time=180"
  11. ::
  12. ::
  13. title %_servername%
  14. :start
  15. C:\Windows\System32\tasklist /FI "IMAGENAME eq arma3server.exe" 2>NUL | C:\Windows\System32\find /I /N "arma3server.exe">NUL
  16. if "%ERRORLEVEL%"=="0" goto loop
  17. echo %_servername% is not running, will be started now
  18. :: SET DIRECTORY TO PROPER LOCATION
  19. start "" /min /wait "%_armaserverpath%start_server.bat"
  20. timeout 30
  21. ::
  22. echo Server started succesfully
  23. goto started
  24. :loop
  25. cls
  26. echo %_servername% is already running, running monitoring loop
  27. :started
  28. :: THESE ARE WERFAULT AND TASK KILLS
  29. taskkill /f /im WerFault.exe /fi "WINDOWTITLE eq %_servername%"
  30. C:\Windows\System32\timeout /t %_time%
  31. C:\Windows\System32\tasklist /FI "IMAGENAME eq arma3server.exe" 2>NUL | C:\Windows\System32\find /I /N "arma3server.exe">NUL
  32. if "%ERRORLEVEL%"=="0" goto loop
  33. goto start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement