Best way to restart your server

Flowan

New Member
Yo,

What is the best way to restart your server? Use a rcon command like #restart or #shutdown? Or close the entire server process and restart it? Just want to know what everyone uses to restart.

I currently restart the server by closing the server process and start it again.

Thanks in advance!

Kind regards,
Flowan
 
I just use #restart through BEC. Works like a charm and have no problems. Players like it better as well because they maintain their connection and it is faster.
 
I just use #restart through BEC. Works like a charm and have no problems. Players like it better as well because they maintain their connection and it is faster.

Nasty solution. Because your db won't clean up. Vehicles won't respawn etc etc
 
I have an automated batch to run the cleanup on a normal schedule and it repopulated destroyed vehicles. Performance shoots back up after the restart and all appear quite pleased with the situation. I am open to new information to change my position, so ... listening.
 
I use bec to do a #shutdown and have firedaemon to monitor it and take it online again. also the vehicle script is executed before server start.
 
I have a bat file that checked every 30 seconds to ensure that my programs are running. I then have BEC run a bat every 8 hours that kills my server processes. That way on the next check my first bat file starts them back up.
 
I use hambeast method he described @ http://dayzprivate.com/forum/index....l?PHPSESSID=5121376g03a8t5sv9b2jpl8ve7#msg403

Basicly a combination of windows task schedular to run a .bat file
A windows batch file to launch server & the following to kill the server

Using https://github.com/ziellos2k/BattleNET
C# Battlenet library
Visual Studio C# 2010 express edition
CS-Script (not needed, but i am lazy and like abiilty to right click when i alter the .cs file to make an new .exe)

Logs into server via rcon, issues warnings to players @ 5min & 1 min...
Then its kills the server process and waits afew seconds,
and then launchs a windows batch file to start the server backup again...

Code:
#region
 
using System;
 
using System.Net;
 
using System.Threading;
 
using System.Diagnostics;
 
using BattleNET;
 
#endregion
 
namespace BattleNET_client
 
{
 
    internal class Program
 
    {
 
        private static void Main(string[] args)
 
        {
 
            Console.Title = "DayZ Ultra Server Restart";
 
       
 
            BattlEyeLoginCredentials loginCredentials = new BattlEyeLoginCredentials();
 
            #region
 
            loginCredentials.Host = "127.0.0.1";
 
            loginCredentials.Port = 2302;
 
            loginCredentials.Password = "YOURPASSWORD";
 
            #endregion
 
            // path to your server start up batch file
 
            string processPath = @"C:\dayz\TAKE4\server.bat";
 
       
 
            // title of your arma2server.exe
 
            string serverTitle = "ArmA 2 OA Console version 1.62 : port 2302";
 
            Console.Title += string.Format(" - {0}:{1}", loginCredentials.Host, loginCredentials.Port);
 
       
 
            IBattleNET b = new BattlEyeClient(loginCredentials);
 
            b.MessageReceivedEvent += DumpMessage;
 
            b.DisconnectEvent += Disconnected;
 
            b.ReconnectOnPacketLoss(true);
 
            b.Connect();
 
            if (b.IsConnected() == false)
 
            {
 
                Console.WriteLine("No connection starting server");
 
                Console.WriteLine("Bringing up server");
 
                Process.Start(processPath);
 
                return;
 
            }
 
            b.SendCommandPacket(EBattlEyeCommand.Say, "-1 Server going down for reset in 5 minutes.  Save vehicles and log off now!");
 
            b.SendCommandPacket(EBattlEyeCommand.Say, "-1 Server going down for reset in 5 minutes.  Save vehicles and log off now!");
 
            b.SendCommandPacket(EBattlEyeCommand.Say, "-1 Server going down for reset in 5 minutes.  Save vehicles and log off now!");
 
            Thread.Sleep(240000);
 
            b.SendCommandPacket(EBattlEyeCommand.Say, "-1 Server going down for reset in 1 minutes.  Save vehicles and log off now!");
 
            b.SendCommandPacket(EBattlEyeCommand.Say, "-1 Server going down for reset in 1 minutes.  Save vehicles and log off now!");
 
            b.SendCommandPacket(EBattlEyeCommand.Say, "-1 Server going down for reset in 1 minutes.  Save vehicles and log off now!");
 
            Thread.Sleep(60000); // wait 1 min
 
            b.SendCommandPacket(EBattlEyeCommand.Say, "-1 Server going down for reset NOW!");
 
            b.SendCommandPacket(EBattlEyeCommand.Say, "-1 Server going down for reset NOW!");
 
            b.SendCommandPacket(EBattlEyeCommand.Say, "-1 Server going down for reset NOW!");
 
            Console.WriteLine("Shutdown cmd");
 
            //b.SendCommandPacket(EBattlEyeCommand.Shutdown);
 
            // disco
 
            Console.WriteLine("Disco cmd");
 
            b.Disconnect();
 
            // force shutdown
 
            var info = Process.GetProcesses();
 
            foreach (Process proc in info)
 
            {
 
                if (proc.MainWindowTitle == serverTitle)
 
                {
 
                    proc.Kill();
 
                    Console.WriteLine("killed proc");
 
                }
 
            }
 
            // restart
 
            Console.WriteLine("wait 5 seconds then bring up server");
 
            Thread.Sleep(5000); // wait 5 seconds to bring it up
 
            Console.WriteLine("Bringing up server");
 
            Process.Start(processPath);
 
        }
 
           
 
        private static void Disconnected(BattlEyeDisconnectEventArgs args)
 
        {
 
            Console.WriteLine(args.Message);
 
        }
 
        private static void DumpMessage(BattlEyeMessageEventArgs args)
 
        {
 
            Console.WriteLine(args.Message);
 
        }
 
    }
 
}
 
BEC Scheduler.

Code:
<?xml version="1.0"?>
<Scheduler>
   
    <job id="0">
        <time>23:30</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 30 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
   
    <job id="1">
        <time>23:45</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 15 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
    <job id="2">
        <time>23:50</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 10 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
    <job id="3">
        <time>23:55</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 5 minutes..</cmd>   
        <cmdtype>0</cmdtype>   
    </job>
   
    <job id="4">
        <time>23:59</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 1 minute.</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
    <job id="5">
        <time>00:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>1</loop>
        <cmd>C:\Program Files\ArmA 2\ServerRestart.bat</cmd>   
        <cmdtype>1</cmdtype>           
    </job>   
   
    <job id="6">
        <time>03:30</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 30 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
   
    <job id="7">
        <time>03:45</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 15 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
    <job id="8">
        <time>03:50</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 10 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
    <job id="9">
        <time>03:55</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 5 minutes..</cmd>   
        <cmdtype>0</cmdtype>   
    </job>
   
    <job id="10">
        <time>03:59</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 1 minute.</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
   
    <job id="11">
        <time>04:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>C:\Program Files\ArmA 2\ServerRestart.bat</cmd>   
        <cmdtype>1</cmdtype>           
    </job>   
   
    <job id="12">
        <time>07:30</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 30 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
   
    <job id="13">
        <time>07:45</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 15 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
    <job id="14">
        <time>07:50</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 10 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
    <job id="15">
        <time>07:55</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 5 minutes..</cmd>   
        <cmdtype>0</cmdtype>   
    </job>
   
    <job id="16">
        <time>07:59</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 1 minute.</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
       
    <job id="17">
        <time>08:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>1</loop>
        <cmd>C:\Program Files\ArmA 2\ServerRestart.bat</cmd>   
        <cmdtype>1</cmdtype>           
    </job>   
   
    <job id="18">
        <time>11:30</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 30 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
   
    <job id="19">
        <time>11:45</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 15 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
    <job id="20">
        <time>11:50</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 10 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
    <job id="21">
        <time>11:55</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 5 minutes..</cmd>   
        <cmdtype>0</cmdtype>   
    </job>
   
    <job id="22">
        <time>11:59</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 1 minute.</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
   
    <job id="23">
        <time>12:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>1</loop>
        <cmd>C:\Program Files\ArmA 2\ServerRestart.bat</cmd>   
        <cmdtype>1</cmdtype>           
    </job>   
   
    <job id="24">
        <time>15:30</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 30 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
   
    <job id="25">
        <time>15:45</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 15 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
    <job id="26">
        <time>15:50</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 10 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
    <job id="27">
        <time>15:55</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 5 minutes..</cmd>   
        <cmdtype>0</cmdtype>   
    </job>
   
    <job id="28">
        <time>15:59</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 1 minute.</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
   
    <job id="29">
        <time>16:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>1</loop>
        <cmd>C:\Program Files\ArmA 2\ServerRestart.bat</cmd>   
        <cmdtype>1</cmdtype>           
    </job>   
   
    <job id="30">
        <time>19:30</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 30 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
   
    <job id="31">
        <time>19:45</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 15 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
    <job id="32">
        <time>19:50</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 10 minutes..</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
    <job id="33">
        <time>19:55</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 5 minutes..</cmd>   
        <cmdtype>0</cmdtype>   
    </job>
   
    <job id="34">
        <time>19:59</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 Server will be rebooted in 1 minute.</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
   
    <job id="34">
        <time>20:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>1</loop>
        <cmd>C:\Program Files\ArmA 2\ServerRestart.bat</cmd>   
        <cmdtype>1</cmdtype>           
    </job>
 
    <job id="35">
        <time>000300</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>1</loop>
        <cmd>loadbans</cmd>
        <cmdtype>0</cmdtype>
    </job>
 
    <job id="36">
        <time>010000</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>1</loop>
        <cmd>say -1 Please use our FB page to report any issues/make suggestions - facebook.com/redlinedayz</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
    <job id="37">
        <time>004500</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>1</loop>
        <cmd>say -1 Voice over sidechat is a kickable offense and bannable for multiple kicks</cmd>   
        <cmdtype>0</cmdtype>           
    </job>
 
       
</Scheduler>

ServerRestart.bat

Code:
taskkill /im arma2oaserver.exe
taskkill /im DayZAntiHax_Win32.exe
taskkill /im bec.exe
taskkill /im DaRT.exe
 
timeout 10
 
:: clean the server..
set cleandir="C:\Users\Charlie\Desktop\DayZServerFiles\"
cd /d %cleandir%
 
start "" "VehicleCleanup.bat"
 
timeout 5
 
start "" "VehicleSpawn50.bat"
 
timeout 5
 
start "" "CleanDead.bat"
 
timeout 5
 
:: start the server..
set dayzpath="C:\Program Files\ArmA 2\"
cd /d %dayzpath%
start "" "server.bat"
 
timeout 10
:: start bec
set becpath="C:\Program Files\ArmA 2\dayz_1.chernarus\Bec"
cd /d %becpath%
start "" "bec.exe" -f Config.cfg
 
timeout 3
:: start antihax
set antihaxpath="C:\Program Files\ArmA 2\dayz_1.chernarus\BattlEye\"
cd /d %antihaxpath%
start "" "DayZAntiHax_Win32.exe"
 
timeout 3
:: start dart
set dartpath="C:\Users\Charlie\Desktop\DaRT\"
cd /d %dartpath%
start "" "DaRT.exe"
 
cls
@exit

The .bat files referenced in the ServerRestart.bat are just there to clean up and spawn things. :)
 
And Server.bat

Code:
start Expansion\beta\arma2oaserver.exe -port=2302 "-config=dayz_1.chernarus\config.cfg" "-cfg=dayz_1.chernarus\basic.cfg" "-profiles=dayz_1.chernarus" -name=Bliss "-mod=@DayZ;@bliss_1.chernarus;" -noPause -noSound -cpuCount=4 -maxMem=4096 -bandwidthAlg=2 -exThreads=7
 
cls
@exit

This method may seem messy ( or it may not ) but it keeps the server monitor clutter free and makes the startup/restart steps modular, making them easy to edit and adjust.
 
I see you increased the use of Threads in your server.bat. Does it really make a difference? And is it safe to use?
 
It seems to improve things, yeah. I found that the alternate networking options ( -bandwidthAlg=2 )made a big difference too.
 
I just have a .bat that loops two things
Cleanup vehicles, and start bec again after 10 minutes
Restarter.exe makes sure the server starts again
 
Have a c# script from hambeast to automate server restarts (server is setup as a windows service) with warnings to users...

Want to change it up slighty now when i get a chance now
i.e
@ 5 mins, warn users
@ 3 mins, warn users
@ 1 mins, warn users + lock server....
@ 0 mins, launch zedar's app https://github.com/nanomo/rconKick to kick all players off the server

Then wait 3-5 mins (server is still locked with no players), to give server time to finish db calls hopefully. And finally restart the server
 
Back
Top