erazeri 1 Posted March 8, 2013 (edited) Here`s a batch files that I created to monitor my Arma 3 dedicated servers and restart it if it had crashed. For one instance (old code): ::Made by eRazeri @echo off :start C:\Windows\System32\tasklist /FI "IMAGENAME eq arma3.exe" 2>NUL | C:\Windows\System32\find /I /N "arma3.exe">NUL if "%ERRORLEVEL%"=="0" goto loop echo Server monitored is not running, will be started now start "" /wait "C:\Steam\SteamApps\common\Arma 3\arma3.exe" -server -nosound -nosplash -nopause -config=C:\server.cfg -cpuCount=4 -maxMem=8192 -exThreads=7 echo Server started succesfully goto started :loop cls echo Server is already running, running monitoring loop :started C:\Windows\System32\timeout /t 10 C:\Windows\System32\tasklist /FI "IMAGENAME eq arma3.exe" 2>NUL | C:\Windows\System32\find /I /N "arma3.exe">NUL if "%ERRORLEVEL%"=="0" goto loop goto start For running multiple server instances on the same server: To enable multiple instances create "steam_appid.txt" into ArmA 3 root with "107410" inside it. NOTE: Affinity number is in hexadecimal!! Table of hexas for cores: 1st core = 1 2nd core = 2 3rd core = 4 4th core = 8 5th core = 10 6th core = 20 7th core = 40 8th core = 80 1st+2nd core =3 1st+2nd+3rd core = 7 1st+2nd+3rd+4th core = F 1st+2nd+3rd+4th+5th core = 1F 1st+2nd+3rd+4th+5th+6th core = 3F 1st+2nd+3rd+4th+5th+6th+7th core = 7F 1st+2nd+3rd+4th+5th+6th+7th+8th core = FF 2nd+3rd+4th+5th+6th+7th+8th core = FE 3rd+4th+5th+6th+7th+8th core = FC 4th+5th+6th+7th+8th core = F8 5th+6th+7th+8th core = F0 6th+7th+8th core = E0 7th+8th core = C0 ::Made by eRazeri @echo off C:\Windows\System32\mode con cols=50 lines=3 >nul set /a var=0 :start echo Running Server start "" /wait /realtime /affinity F "C:\Steam\SteamApps\common\Arma 3\arma3.exe" -server -port=2402 -nosound -nosplash -nopause -config=C:\server_1.cfg -cpuCount=4 -maxMem=4096 -exThreads=7 set /a var+=1 cls echo Server has crashed %var% times, restarting goto start What is a batch file you ask? Simply paste above code into a .txt file created for example with notepad and rename it for example "autorestarter.bat". After that you just run it. If you want a custom name for it, create a shortcut and rename it to what you want the window name to be. You can run it anywhere just check that the paths of the exe and config are correct. Also remember to change parameters accordingly. This also relies on that you`ve disabled your Windows Error reporting: For Vista / Win7 / Server 2008 etc: 1. Open start menu and type “gpedit.mscâ€. The Local Group Policy editor will appear. 2. Navigate to Computer Configuration / Administrative Templates / Windows Components / Windows Error Reporting 3. Edit the entry for “Prevent display of the user interface for critical errors†4. Set it to Enabled. Edited March 10, 2013 by eRazeri Edited code for resized window Share this post Link to post Share on other sites
RozekPoland 591 Posted March 8, 2013 -maxMem=8192 what for?according to community.bistudio.com 2047 is hard-coded maximum (anything higher falls back to 2047). http://community.bistudio.com/wiki/Arma2:_Startup_Parameters Share this post Link to post Share on other sites
erazeri 1 Posted March 8, 2013 what for?according to community.bistudio.com http://community.bistudio.com/wiki/Arma2:_Startup_Parameters Because I haven`t got proof that it doesn't work in ArmA 3, do you? Even if it lowers it to the maximum there`s no harm done. But really put in whatever you like, it`s there just for an example. Share this post Link to post Share on other sites
Lokyi 10 Posted March 8, 2013 ...because it's still only a 32-bit process, it won't address that much memory. Your script is win though, have been running it since I saw it on one of the other threads earlier. Share this post Link to post Share on other sites
SavageCDN 231 Posted March 8, 2013 Thanks for this!! Share this post Link to post Share on other sites
LondonLad 13 Posted March 8, 2013 I'll also send my thanks for this script - Working well for our A3 Server :) Share this post Link to post Share on other sites
kazenokizu 10 Posted March 8, 2013 going to try this out latter Share this post Link to post Share on other sites
Kinsman 10 Posted March 9, 2013 Script is brilliance! but does cause me one issue now, prob a good one to have I guess. How do I tell how many times the server has crashed during the day? :) Share this post Link to post Share on other sites
Lokyi 10 Posted March 9, 2013 You don't as it is, unless you add some line in there to keep adding a number each time it runs the start section... but that's beyond me lol Share this post Link to post Share on other sites
erazeri 1 Posted March 9, 2013 (edited) Updated with support for multiple instances and new code calculates server crashes (NOTE: it will also count instant crashes)! Edited March 9, 2013 by eRazeri Share this post Link to post Share on other sites
cm. 10 Posted March 9, 2013 Script is brilliance! but does cause me one issue now, prob a good one to have I guess. How do I tell how many times the server has crashed during the day? :) setting a global variable should do the trick Share this post Link to post Share on other sites
dcthehole 1 Posted March 9, 2013 Simply amazing thank you from me and everyone at Team Deadly. Share this post Link to post Share on other sites
bensch 1 Posted March 10, 2013 If you use a windows server machine, then I recommend the Windows Powershell to organize your server. It's a modern way and in my opinion the better way. :) Share this post Link to post Share on other sites
cm. 10 Posted March 10, 2013 If you use a windows server machine, then I recommend the Windows Powershell to organize your server. It's a modern way and in my opinion the better way. :) definitely, however I haven't taken the time to learn it all just yet :) Share this post Link to post Share on other sites
Lokyi 10 Posted March 11, 2013 Yeah, Powershell is baus once you learn how to use it. Can do pretty much everything via script without having to RDC. Share this post Link to post Share on other sites
-J4F- Thunder666 10 Posted May 5, 2013 (edited) hi Guys, thx for this file but today we need a little bit Help and i hope you can help us. I tried to setup multiple Servers. first with the Restarter.exe form Armaholic. No Problems all fine. So since last patch i think(not sure) we can start multiple Servers but we can only connect to the Server that was launched 1st. Now i tried this batch(3 different config files) file with the same Result. :( we only can connect to the server that was launched at 1st. maybe there is somthinbg wrong with our cfg but i dont think so. // server.cfg // comments are written with "//" in front of them. // GLOBAL SETTINGS hostname = "[J4F] GER ARMA 3 C&H Server(Ranking System)"; password = ""; passwordAdmin = "j4f-squad"; reportingIP = "arma2oapc.master.gamespy.com"; logFile = "server_c&h.log"; motd[] = { "Welcome to ****", "Have fun and dont cheat", }; motdInterval = 5; // JOINING RULES maxPlayers = 70; kickDuplicate = 1; verifySignatures = 2; // INGAME SETTINGS disableVoN = 0; vonCodecQuality = 8; persistent = 1; timeStampFormat = "short"; // MISSIONS CYCLE (see below) class Missions { class ch1 { template="[J4F]_C&H_Battle_of_Girna_RS.Stratis"; difficulty = "veteran"; }; }; please help us thx in advance Edited May 5, 2013 by [J4F] Thunder666 Share this post Link to post Share on other sites
Winchester Delta_1 0 Posted July 4, 2013 Hello, wonderfull script you made there. The script works perfectly if you close the arma 3 server manually. But if it crashes the arma3 server won't restart. This because the Windows arma3 error dialog "Arma3 has crashed. Press ok or cancel to close the progam" won't entirely close arma3server.exe untill you press OK or cancel. So it is not really effective in my case. I'm trying now to fix it with the task kill command taskkill /f /im "arma3server.exe". But my server has not crashed yet for me to know if it works. Can somebody help me out with this and take a look at the edited code i have. ::Made by eRazeri @echo off :start C:\Windows\System32\tasklist /FI "IMAGENAME eq arma3server.exe" 2>NUL | C:\Windows\System32\find /I /N "arma3server.exe">NUL if "%ERRORLEVEL%"=="0" goto loop echo 9thInfantry ARMA III Beta server is running. Keep this CMD window open if you want the server to restart when it crashes. start "" /wait "C:\Program Files (x86)\Steam\SteamApps\common\Arma 3\Arma3server.exe" -mod=@ASM -profiles=C:\Program Files (x86)\Steam\SteamApps\common\Arma3\Users\ -cfg=basic.cfg -cpuCount=2 -nosound -port=2629 -config=config.cfg - name=9thArmAIIIServerMain echo 9thInfantry Server started succesfully goto started :loop cls echo Server is already running, running monitoring loop :started C:\Windows\System32\timeout /t 10 C:\Windows\System32\tasklist /FI "IMAGENAME eq arma3server.exe" 2>NUL | C:\Windows\System32\find /I /N "arma3server.exe">NUL if "%ERRORLEVEL%"=="0"[color="#FF0000"] taskkill /f /im "arma3server.exe"[/color] goto loop Share this post Link to post Share on other sites
erazeri 1 Posted July 7, 2013 Hello, wonderfull script you made there.The script works perfectly if you close the arma 3 server manually. But if it crashes the arma3 server won't restart. This because the Windows arma3 error dialog "Arma3 has crashed. Press ok or cancel to close the progam" won't entirely close arma3server.exe untill you press OK or cancel. So it is not really effective in my case. As stated in the OP: This also relies on that you`ve disabled your Windows Error reporting: For Vista / Win7 / Server 2008 etc: 1. Open start menu and type “gpedit.mscâ€. The Local Group Policy editor will appear. 2. Navigate to Computer Configuration / Administrative Templates / Windows Components / Windows Error Reporting 3. Edit the entry for “Prevent display of the user interface for critical errors†4. Set it to Enabled. Share this post Link to post Share on other sites