Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- C:\Windows\System32\mode con cols=51 lines=5 >nul
- cls
- color 0a
- set /a varA=0
- set /a varB=0
- set watch=DayZ SA Server
- title %watch% Auto Restart / Process Monitor
- set profiles=ServerProfile
- set mods=DayZ-SA-Tomato;
- :start
- REM // How long until auto restart?
- set hours="4"
- set minutes="0"
- set seconds="0"
- REM // Launch parameters.
- start "Dayz Server" /high "DayZServer_x64.exe" -config=serverDZ.cfg -port=2302 -profiles=%profiles% -adminlog -freezecheck -scriptDebug=true -cpuCount=4 "-mod=%mods%" -scrAllowFileWrite -filePatching
- REM // You do not need to update anything else below this line.
- for /f "delims=" %%G IN ('powershell "(get-date %time%).AddHours(%hours%).AddMinutes(%minutes%).AddSeconds(%seconds%).ToString('yyyyMMddHHmmss')"') do set endtime=%%G
- for /f "delims=" %%G IN ('powershell "(get-date %time%).ToString('HH:mm:ss')"') do set nowtimeclean=%%G
- for /f "delims=" %%G IN ('powershell "(get-date %time%).AddHours(%hours%).AddMinutes(%minutes%).AddSeconds(%seconds%).ToString('HH:mm:ss')"') do set endtimeclean=%%G
- cls
- color 0a
- echo %time% - %watch% started at %nowtimeclean%
- echo %time% - and will restart at %endtimeclean%
- echo.
- echo %time% - Restarts: %varB%. Crashes: %VarA%.
- :checkdayz
- for /f "delims=" %%G IN ('powershell "(get-date %time%).ToString('yyyyMMddHHmmss')"') do set nowtime=%%G
- if "%nowtime%" gtr "%endtime%" (
- set /a varB+=1
- cls
- color 0e
- echo %time% - Time is up.
- echo %time% - Restarting %watch%!
- goto restartdayz
- )
- tasklist /FI "IMAGENAME eq DayZServer_x64.exe" 2>NUL | find /I /N "DayZServer_x64.exe">NUL
- if "%ERRORLEVEL%"=="1" (
- set /a varA+=1
- cls
- color 0c
- echo %time% - %watch% closed or crashed.
- echo %time% - Restarting %watch%!
- goto restartdayz
- )
- TIMEOUT /T 3 /NOBREAK >NUL
- goto checkdayz
- :restartdayz
- START taskkill /f /im DayZServer_x64.exe 2>nul
- TIMEOUT /T 3 /NOBREAK >NUL
- goto start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement