Omen 35 Report post Posted November 12, 2015 (edited) I couldn't get the built in auto restart to work nor any of the other user provided scripts so I pieced together one that works for me. It may or may not work for you but I figured I would share since this is a modding community. You can probably clean up the code since I am far from a programmer. With this batch file you can - Set the restart time down to the second It tells you when your server started and when it is going to restart automatically It tells you if/when your server crashed and restarts it for you Time stamps everything so you know when everything happened No need for BEC or anything else third party, just PowerShell and my server came with it Checks on your server every 3 seconds and restarts when needed Timer restarts if your server crashes This screenshot shows it running at 1 minute intervals to test and display the status messages. I killed the process manually to test the process checker and restart. Then I let it run for the 1 minute and you can see it notifies you that it is time for a restart and does so without user interaction. Usage - Set your restart timer (below is for 4 hour restarts) set hours="4" set minutes="0" set seconds="0" Set your launch parameters and folder paths REM // Launch parameters start "Exile" /high "arma3server.exe" -port=2302 "-config=@ExileServer\config.cfg" "-cfg=@ExileServer\basic.cfg" "-profiles=config_exile" -name=Exile "-servermod=@ExileServer;" "-mod=@Exile;" -malloc=tbbmalloc -autoinit -enableHT Run the batch file. Place the batch file in the same folder as arma3server.exe The Batch File (save as auto_restart.bat or anothername.bat) @echo off cls set gameserver=Arma Exile title %gameserver% Auto Restart / Process Checker :start REM How long until auto restart? set hours="4" set minutes="0" set seconds="0" REM // Launch parameters start "Exile" /high "arma3server.exe" -port=2302 "-config=@ExileServer\config.cfg" "-cfg=@ExileServer\basic.cfg" "-profiles=config_exile" -name=Exile "-servermod=@ExileServer;" "-mod=@Exile;" -malloc=tbbmalloc -autoinit -enableHT REM //////// You do not need to update anything else below this line //////// REM Pull, display and create some time functions 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 echo %time% - %gameserver% Server started at %nowtimeclean% and will restart at %endtimeclean% :checkarma for /f "delims=" %%G IN ('powershell "(get-date %time%).ToString('yyyyMMddHHmmss')"') do set nowtime=%%G REM ////////// TIMER CHECK /////////// if "%nowtime%" gtr "%endtime%" ( echo %time% - It is time to restart %gameserver%! echo. echo. goto restartarma ) REM ////////// END TIMER CHECK /////////// REM ////////// PROCESS CHECK /////////// tasklist /FI "IMAGENAME eq arma3server.exe" 2>NUL | find /I /N "arma3server.exe">NUL if "%ERRORLEVEL%"=="1" ( echo %time% - The process is not running, restart %gameserver%! echo. echo. goto restartarma ) REM ////////// END PROCESS CHECK /////////// REM restart not needed. Check again in 3 seconds. TIMEOUT /T 3 /NOBREAK >NUL goto checkarma :restartarma REM Either the server crashed or it is time for a restart. Kill the process and go to start. START taskkill /f /im arma3server.exe 2>nul TIMEOUT /T 3 /NOBREAK >NUL goto start If you can improve on this then by all means please do and post your fixes / updates / optimizations. Enjoy! Edited January 1, 2016 by Omen 2 Share this post Link to post Share on other sites
Fendo 3 Report post Posted December 31, 2015 Your script is working well for me. But it would be nice if you can set a specific time for the restart. Like 6am and then every 6h so it restarts at 0,6,12,18 Share this post Link to post Share on other sites
Mezo 1264 Report post Posted January 1, 2016 Nice work. 21 hours ago, Fendo said: Your script is working well for me. But it would be nice if you can set a specific time for the restart. Like 6am and then every 6h so it restarts at 0,6,12,18 You can do that through windows task scheduler 1 Share this post Link to post Share on other sites
GamersRoost 265 Report post Posted January 1, 2016 On 11/12/2015 at 1:25 PM, Omen said: I couldn't get the built in auto restart to work nor any of the other user provided scripts so I pieced together one that works for me. It may or may not work for you but I figured I would share since this is a modding community. You can probably clean up the code since I am far from a programmer. With this batch file you can - Set the restart time down to the second It tells you when your server started and when it is going to restart automatically It tells you if/when your server crashed and restarts it for you Time stamps everything so you know when everything happened No need for BEC or anything else third party, just PowerShell and my server came with it Checks on your server every 3 seconds and restarts when needed Timer restarts if your server crashes This screenshot shows it running at 1 minute intervals to test and display the status messages. I killed the process manually to test the process checker and restart. Then I let it run for the 1 minute and you can see it notifies you that it is time for a restart and does so without user interaction. Installation - Set your restart timer (below is for 4 hour restarts) Hidden Content Set your launch parameters and folder paths Hidden Content Run the batch file. The Batch File (save as auto_restart.bat or anothername.bat) Hidden Content If you can improve on this then by all means please do and post your fixes / updates / optimizations. Enjoy! Finally people are using PowerShell for Windows tasks! Good work man. Ill get-someCoffee | Add-ThisToServer | Set-Areply Soon! 1 Share this post Link to post Share on other sites
Omen 35 Report post Posted January 1, 2016 The main script has been updated. The date formatting was off and it didn't like it when the start time was 2015 and restart was 2016. It kept thinking it was time to restart the server. I have fixed the date formatting so now you should be good to go. Share this post Link to post Share on other sites
Hatler 0 Report post Posted January 7, 2016 (edited) NICE BIG THX !!!! BUT NO TIME IN MY CONSOLE FOR SERVER RESTART and and and ...... its a space in the line echo %time% - %gameserver% Server started at %nowtimeclean% and will restart at %endtimeclean% Edited January 7, 2016 by Hatler Share this post Link to post Share on other sites
ka0s 457 Report post Posted January 7, 2016 You might want to add a check for "Not responding" as well, I have that with mine, my server haven't been hanging ever since I made that check, it simply just kills the hanging process and restart the server Share this post Link to post Share on other sites
Hatler 0 Report post Posted January 7, 2016 (edited) noooo ^^ my english is not so good.... i have no time in the line (in the middl) Edited January 7, 2016 by Hatler Share this post Link to post Share on other sites
Hatler 0 Report post Posted January 7, 2016 and the shutdown @ 4h dosn´t work Share this post Link to post Share on other sites
Ton_41 1 Report post Posted January 18, 2016 It work but don't have massage in server to talk when server will restart in a mins. Share this post Link to post Share on other sites