Jump to content
dizzymagoo

DayZ Server Auto Restart - Multiple Methods - **Version 3.3.1

Recommended Posts

Hey all!

I run the Denver 1 US Server and I have a couple different methods here you can use to auto restart your server!

Method 1 - Using Batch Script

You can use the following batch file to just restart the server when it crashes/exits.

@echo off

cls

echo Protecting ArmA II from crashes...

title ArmA II Server Watcher

:arma

echo (%time%)ArmA II started.

start /wait arma2oaserver.exe -mod=EXPANSION;ca;@dayz;@CBA;@JayArma2Lib -name=cfgdayz -config=cfgdayz\server.cfg -cfg=cfgdayz\arma2.cfg -profiles=cfgdayz -world=Chernarus -cpuCount=4 -exThreads=7

echo (%time%) ATTENTION: ArmA closed or crashed, restarting.

goto arma

Method 2 - In Development Application

I made this small application for watching my server and restarting it when/if it crashes! I also added a feature to restart the hive every x minutes. Keep in mind its still in the works!!

[Version 1.0]

-Released

[Version 2.0]

-Fixed issues with my bad math skills

-Fixed issues where it might launch the server over and over

-Added a scary skin

-Added ability to restart server every x hours

-Added ability to use launch parameters

-Added ability to save settings

-Added logging to text file

-Changed hive auto restart to hrs instead of minutes

[Version 3.2]

-Started over on the entire application. Made it much more universal

-Changed Everything

[Version 3.3]

-Did a lot of code cleaning. Things run much smoother now.

-Some UI tweaks. No need for colors, just useless code.

-It now checks to see if the server is responding. If not, kills it.

-It logs EVERYTHING now.

-Now added check for BEC.

[Quick Fix 3.3.1]

-Fixed issues where the config file might save a number for the counters that was invalid. It also now displays the correct values in the settings menu instead of milliseconds.

Notes: Your settings config and log file will be saved to the directory that you run the application from. You can run multiple instances of the application but you might have issues saving different settings for different servers.

The parameters are the ones of your usual start up batch file!

Example of Parameters: -mod=EXPANSION;ca;@dayz;@CBA;@JayArma2Lib -name=cfgdayz -config=cfgdayz\server.cfg -cfg=cfgdayz\arma2.cfg -profiles=cfgdayz -world=Chernarus -cpuCount=4 -exThreads=7

Tested Operating Systems:

Windows Server 2003

Windows Server 2008 R2

Windows 7

http://www.theprogamers.com/stuff/ServerMonitor.exe

Regards,

Dizzymagoo

  • Like 2

Share this post


Link to post
Share on other sites

#1 question; I was told if the hive needed a restart, to close the game servers, restart the HiveAuth, then the Hive, then restart the servers....

Is it fine to just restart the hive?

Share this post


Link to post
Share on other sites

Generally speaking that's not a great thing to do, no. Restarting a server doesn't matter and you can leave the Hive running, when it comes to the other way around, it's a lot better to restart the server(s) too.

Share this post


Link to post
Share on other sites

If I'm correct and we are supposed to close down the servers, then the hive/hiveauth/monitor... then it would be best to utilize a program like this to auto exec the stop.bat file, and the monitor.bat file on the server at set time intervals.

Share this post


Link to post
Share on other sites

I restart my server regularly (6-8 hours) to make sure everything is running smoothly. Having a few issues due to the "Monitor" Software the dev's have put on there at the moment though, but once thats fixed, normal service will resume. 2 weeks without issue then this happens lol.

Share this post


Link to post
Share on other sites

I have been restarting the hive without shutting down the server. I haven't seen any obvious issues with it... yet. If you all would prefer that I change it to just auto restart the server and hive every x hours I can do that as well! I'm very open to suggestions!

Regards,

Dizzymagoo

Share this post


Link to post
Share on other sites

Dizzy, when I use your application it just keeps opening the server multiple times every 30 seconds

I'm using it on Windows 2003 32 bit

Share this post


Link to post
Share on other sites

When you say its opening the server. Is it opening hive.exe? hiveAuth.exe? arma2oaserver.exe? Or all three? Thanks for the input! Im getting ready to release a new version, been working on it for hours. Hopefully I can get this issue resolved quickly.

EDIT: I just ran it on my 32-Bit Server 2003 box and got this... testwatchdog.png

Seems to work fine? Can you post a screenshot of what its doing please?

Regards,

Dizzymagoo

Share this post


Link to post
Share on other sites

I'll take a screenshot later, my servers are running and I don't want to take them down right now

It gave me those same messages except that it kept opening the DayZ Server 1.bat file over and over again and launching multiples of the same server. Hive and HiveAuth were fine

Share this post


Link to post
Share on other sites

Okay, I found my mistake in the coding that probably caused this issue. Thank you for bringing it to my attention! I award you with one cookie :P

Regards,

Dizzymagoo

Share this post


Link to post
Share on other sites

I'll check out the new version once you release it and see if that fixed it

Would it be possible to use this application for 2 servers? (I have 2 server files running)

Share this post


Link to post
Share on other sites

You can run two instances of the watch dog(I would recommend this). However you can't run the watch dogs both from the same directory with the new feature im adding. It would cause mass conflict. With other features that im adding, it also eliminates your start up batch files. It will launch the executable directly with the parameters you add.

Regards,

Dizzymagoo

Share this post


Link to post
Share on other sites

Dizzy,

I tried the new version and it still keeps opening multiple servers during the "server check"

Here's a screenshot just as it opened a 2nd one:

7zqGz.jpg

Working directory: C:\Program Files (x86)\Steam\steamapps\common\arma 2 operation arrowhead

Paramaters: -mod=EXPANSION;ca;@dayz;@CBA;@JayArma2Lib -name=cfgdayz -config=cfgdayz\server.cfg -cfg=cfgdayz\arma2.cfg -profiles=cfgdayz -world=Chernarus -cpuCount=4 -exThreads=7

Share this post


Link to post
Share on other sites

DJKhaled,

It appears that you ran your start up batch script. There is no need for the batch script.

Regards,

Dizzymagoo

Share this post


Link to post
Share on other sites

Dizzy,

I started from arma2oaserver.exe and it's still doing it. It just endlessly opens up new servers, it seems that it's not detecting that arma2oaserver.exe is currently running

5Lemo.jpg

Share this post


Link to post
Share on other sites

Few questions.

1) Where must be located hive and hiveauth? It is located now in

\hive\

2) I get NET.framework error. What version i need to install?

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at System.String.Substring(Int32 startIndex, Int32 length)
at ArmaWatchDog.Form1.Form1_Load(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.239 (RTMGDR.030319-2300)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
ArmaWatchDog
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/dayzteam/Desktop/DAYZWATHCDOG/ArmaWatchDog.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 10.0.0.0
Win32 Version: 10.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.258 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.235 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:





When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


Share this post


Link to post
Share on other sites

Thank you so much for making this and releasing it publicly. You're saving many admins a lot of headache.

Share this post


Link to post
Share on other sites

I can't get it to launch correctly... I 'm using the same launch parameters that the serverlaunch batch file uses, and that one works fine. Also, the background seems to cause it to load really slow and might be whats causing the issue, because I get the .net error as well.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×