Server launch .BAT file and Restart system Tutorial

Discussion in 'Sahrani' started by limit79, Jun 7, 2013.

  1. limit79

    limit79 Member

    Joined:
    Nov 2, 2012
    Messages:
    63
    Likes Received:
    7
    Hi this is my first tutorial I have done about this so please don’t hate me if I have got this wrong but this is what works for me after a lot of testing on my VPS server box I think it might help others.

    Things you will need to make this work
    Notepad++
    BEC
    (Battleye Extended Controls)
    you can Google this for links they are not hard to fine.

    So why do we need thes files well BEC help with running server commands on the host box and putting up messages in-game like telling a client when the server will restart.

    Notepad is so you can make a “.BAT” file that will run/restart the server

    Lets start
    Step One

    Install BEC in to your DayZ server folder and set it up to run with the server
    (im not going to go in to how to set it up and stuff please see there website for the info on installing BEC)
    to run BEC by it self you will need to make a ".BAT" file
    to do this you need to open up notepad++ and put this command in
    "Bec.exe -f Config.cfg" with out the " " and make sure you put in the same folder where you have the BEC.EXE in to it can start it up (make sure you Config the Config.cfg file befor you start it up)



    So this will get BEC working on ur server and stuff but it will not do the restart system yet.
    This is more a test to make sure BEC is working.


    Step Two
    Set up your Scheduler.XML file located in in the Config file folder. Open it up in notepad++ and edit the info for the restart part the command for #restart only restarts the mission not the server its self and it is better to have the hole server restart not just the mission file. (again im not going in to detail here you will see what im talking about when you look at the file)


    Here is the restart info you will need



    Code:
    <!-- *** RESTARTS *** -->
    
        <!-- 5 min to the 06:00 restart -->
    
        <job id="2">
    
            <time>05:55:00</time>
    
            <delay>000000</delay>
    
            <day>1,2,3,4,5,6,7</day>
    
            <loop>0</loop>
    
            <cmd>say -1 This server will restart in 5 min.</cmd>
    
            <cmdtype>0</cmdtype>        
    
        </job>
    
        <!-- 06:00 restart -->
    
        <job id="3">
    
            <time>06:00:00</time>
    
            <delay>000000</delay>
    
            <day>1,2,3,4,5,6,7</day>
    
            <loop>0</loop>
    
            <cmd>C:\Users\Administrator\Desktop\Dayz Server Files\Server_Restart.bat</cmd>
    
            <cmdtype>1</cmdtype>        
    
        </job>
    
    
    As you can see i have the cmd pointing to a Server_Restart.bat file in this file i have a few commands that will help with the server restarting (see step three) this is an impotent file to have or the server will NOT restart at all. Also make sure you have the cmdtype set to 1 or the command wont work. And make sure to have loop set 0 as we don't want to loop it to loop at all.

    Step three
    this is where we have some fun stuff to do. We need to make two different ".BAT" files to make sure the server restart right. You could do this in one file but i think this is just a better way of doing it.


    First file we need to make is Server_Restart.bet all this info in here will help to close the server down (Shut the server down) and at the same time start up a new ".BAT" file that will Start the server back up again.

    SO here is the info you need in the Server_Restart.bat
     
    Last edited: Mar 25, 2014
    zzzTNTzzz and Nonov Urbizniz like this.
  2. limit79

    limit79 Member

    Joined:
    Nov 2, 2012
    Messages:
    63
    Likes Received:
    7
    Code:
    @echo off
    echo.
    echo KILL arma2oaserver.exe
    set serverkill="C:\Users\Administrator\Desktop\Dayz Server Files\Expansion\beta"
    cd /d %serverkill%
    taskkill /im arma2oaserver.exe
    echo.
    echo Kill Bec.exe
    set beckill="C:\Users\Administrator\Desktop\Dayz Server Files\dayz_1.sara\BEC"
    cd /d %beckill%
    taskkill /im bec.exe
    
    timeout 10
    
    echo.
    echo Starting Dayz Server
    :: start the server..
    set dayzpath="C:\Users\Administrator\Desktop\Dayz Server Files\"
    cd /d %dayzpath%
    start "" "Server_Start_New.bat"
    echo.
    echo Starting Bec
    timeout 10
    :: start bec
    set becpath="C:\Users\Administrator\Desktop\Dayz Server Files\dayz_1.sara\BEC"
    cd /d %becpath%
    start "" "bec.exe" -f Config.cfg
    echo.
    echo Server Started 100%
    
    cls
    @exit
    So now you are thinking WTF is all this info let me tell you what all the comands do so you can understand what it is and how it works

    1. set name="path" - this is so you can set a path to a file on the server to run a comand
    2. cd /d %name% - this comand tells the BAT file when to run the "set" string
    3. start " " "File_Name.bet" - this is the file we want to run with the "set" command

    4. taskkill "" this tells the system to close/shutdown the file name
    5. /im "" i think this is telling it that's its a file to run (im not 100% sure)
    6. timeout "" is like a pause for a amount of time EG. "timeout 10" will wait for 10sec
    7. cls "" i think this is a clear
    command
    8. @exit "" will exit the file at the end to make sure is run right


    The next file we will make is a file that will Start up your DayZ Server.
    This file i named it Server_Start_New.bat but you can name it what ever you like
    in this “.BAT” file we will add the server comands



    Code:
    timeout 10
    
    ::Start Dayz Server::
    
    start "" Expansion\beta\arma2oaserver.exe "-mod=Expansion\beta;Expansion\beta\Expansion" "-nosplash" "-cpuCount=1" "-name=Sara" "-profiles=dayz_1.sara" "-cfg=dayz_1.sara\basic.cfg" "-config=dayz_1.sara\config_1234567.cfg" "[email protected]_Sahrani;@hive-sara" "-world=sara" "-port=2302"
    
    cls
    
    @exit
    This is all the info for starting up the server please not to change the “PATHS” to your files as this is the path to my file. They will be different on your server box. I do not take any responsibility for any files not working or system not running it. I'm doing this to show you how to do it. If you just COPY & PASTE this will not work you will need to edit the command for it to work with your server.

    I hope this has helped with getting you server to restart on time and work 100%
    thanx for reading and if you need to know more please post ill do my best to help.
     
    Last edited: Mar 25, 2014
    Nonov Urbizniz and Garett like this.
  3. Garett

    Garett New Member

    Joined:
    May 24, 2013
    Messages:
    25
    Likes Received:
    1
    Thank you. This works great. Had to change a bit, for my server, but put me in right direction and so far, working great!
     
  4. Carp!

    Carp! Well-Known Member

    Joined:
    Oct 14, 2013
    Messages:
    114
    Likes Received:
    2
    Hey man cool guide thanks!

    Curious, why have a seperate command to kill bec when after you kill the arma service, bec closes anyway? You do it just for verification?

    EDIT: Ahh ok its to close the previous one, I get it now heh.

    Would you happen to know why i get a box that says "Not enough storage is available to process this command?" The batch file works like a charm, but i have that dos window up.
     
    Last edited: Mar 25, 2014
  5. limit79

    limit79 Member

    Joined:
    Nov 2, 2012
    Messages:
    63
    Likes Received:
    7
    where you have this command
    you need to add a place holder for the "" part so you dont get a overflow problems

    EG.
    it will just have it a place holder and no do anythink to the server at all
     
    Carp! likes this.
  6. Carp!

    Carp! Well-Known Member

    Joined:
    Oct 14, 2013
    Messages:
    114
    Likes Received:
    2
    This did it, tyvm.

    EDIT: Aww it tricked me :( It still leaves the cmd.exe window up without the error message and just shows the directory arma is in :(

    EDIT2: Added taskkill /im cmd.exe after bec and it closes that box. Thanks again looks so clean now.
     
    Last edited: Mar 25, 2014
  7. Winter189

    Winter189 Member

    Joined:
    Jul 13, 2014
    Messages:
    78
    Likes Received:
    8
    All i get is waiting for server to start in bec? Whats that issue?
     
  8. limit79

    limit79 Member

    Joined:
    Nov 2, 2012
    Messages:
    63
    Likes Received:
    7
    "All i get is waiting for server to start in bec? Whats that issue?"

    Make sure you have the right path to your server files.
    set dayzpath="C:\***pathtoyourserver***\Dayz Server Files\"
    set becpath="C:\***pathtoyourserver***\Dayz Server Files\dayz_1.sara\BEC"

    I hope this helps man its been a long time I haven't played around with because and .bat files in some time. Some of the commands might have changed good luck man.
     
    Nonov Urbizniz likes this.
  9. LINKEN

    LINKEN New Member

    Joined:
    Mar 22, 2014
    Messages:
    1
    Likes Received:
    0
    THX for this. works nice!!
     
  10. boris62

    boris62 Member

    Joined:
    Jan 12, 2015
    Messages:
    30
    Likes Received:
    0
    Hello. You couldn't помочт to me in adjustment Scheduler. I badly understand English language, and consequently at me the problem with adjustment of messages before server restart. Here mine Scheduler: <Scheduler>

    <! - IMPORTANT: Visit www.ibattle.org for usage guides->
    <! - Guide For Using Scheduler System: http://ibattle.org/install-and-configure/setting-up-the-scheduler/->

    <! - 2 Time Formats Can Be Used:
    0:00:00 AM - HH:MM:SS - Example, 2:30:00 AM would be 2:30am. Messages using this format are sent based on the node's time. It is recommend to set your ACP profile time to the same timezone as the node.
    000000 - HHMMSS - Example, 003000 Is 30 Minutes From When Server Started
    ->

    <! - Restart (Every 02:00, 06:00, 10:00, 14:00, 18:00, 22:00 hours)->

    <! - START: 10pm Restart->
    <job id = "0">
    <time> 21:30:00 </time>
    <delay> 000000 </delay>
    <day> 1,2,3,4,5,6,7 </day>
    <loop> 0 </loop>
    <cmd> say-1 Server Restart in 30 minutes </cmd>
    <cmdtype> 0 </cmdtype>
    </job>

    <job id = "1">
    <time> 21:58:00 </time>
    <delay> 000000 </delay>
    <day> 1,2,3,4,5,6,7 </day>
    <loop> 0 </loop>
    <cmd> say-1 Server Restart in 2 minutes </cmd>
    <cmdtype> 0 </cmdtype>
    </job>
    <! - END: 10pm Restart->

    <! - START: 2am Restart->
    <job id = "2">
    <time> 01:30:00 </time>
    <delay> 000000 </delay>
    <day> 1,2,3,4,5,6,7 </day>
    <loop> 0 </loop>
    <cmd> say-1 Server Restart in 30 minutes </cmd>
    <cmdtype> 0 </cmdtype>
    </job>

    <job id = "3">
    <time> 01:58:00 </time>
    <delay> 000000 </delay>
    <day> 1,2,3,4,5,6,7 </day>
    <loop> 0 </loop>
    <cmd> say-1 Server Restart in 2 minutes </cmd>
    <cmdtype> 0 </cmdtype>
    </job>
    <! - END: 2am Restart->


    <! - START: 6am Restart->
    <job id = "4">
    <time> 05:30:00 </time>
    <delay> 000000 </delay>
    <day> 1,2,3,4,5,6,7 </day>
    <loop> 0 </loop>
    <cmd> say-1 Server Restart in 30 minutes </cmd>
    <cmdtype> 0 </cmdtype>
    </job>

    <job id = "5">
    <time> 05:58:00 </time>
    <delay> 000000 </delay>
    <day> 1,2,3,4,5,6,7 </day>
    <loop> 0 </loop>
    <cmd> say-1 Server Restart in 2 minutes </cmd>
    <cmdtype> 0 </cmdtype>
    </job>
    <! - END: 6am Restart->


    <! - START: 10am Restart->
    <job id = "6">
    <time> 09:30:00 </time>
    <delay> 000000 </delay>
    <day> 1,2,3,4,5,6,7 </day>
    <loop> 0 </loop>
    <cmd> say-1 Server Restart in 30 minutes </cmd>
    <cmdtype> 0 </cmdtype>
    </job>

    <job id = "7">
    <time> 09:58:00 </time>
    <delay> 000000 </delay>
    <day> 1,2,3,4,5,6,7 </day>
    <loop> 0 </loop>
    <cmd> say-1 Server Restart in 2 minutes </cmd>
    <cmdtype> 0 </cmdtype>
    </job>
    <! - END: 10am Restart->


    <! - START: 2pm Restart->
    <job id = "8">
    <time> 13:30:00 </time>
    <delay> 000000 </delay>
    <day> 1,2,3,4,5,6,7 </day>
    <loop> 0 </loop>
    <cmd> say-1 Server Restart in 30 minutes </cmd>
    <cmdtype> 0 </cmdtype>
    </job>

    <job id = "9">
    <time> 13:58:00 </time>
    <delay> 000000 </delay>
    <day> 1,2,3,4,5,6,7 </day>
    <loop> 0 </loop>
    <cmd> say-1 Server Restart in 2 minutes </cmd>
    <cmdtype> 0 </cmdtype>
    </job>
    <! - END: 2pm Restart->


    <! - START: 6pm Restart->
    <job id = "10">
    <time> 17:30:00 </time>
    <delay> 000000 </delay>
    <day> 1,2,3,4,5,6,7 </day>
    <loop> 0 </loop>
    <cmd> say-1 Server Restart in 30 minutes </cmd>
    <cmdtype> 0 </cmdtype>
    </job>

    <job id = "11">
    <time> 17:58:00 </time>
    <delay> 000000 </delay>
    <day> 1,2,3,4,5,6,7 </day>
    <loop> 0 </loop>
    <cmd> say-1 Server Restart in 2 minutes </cmd>
    <cmdtype> 0 </cmdtype>
    </job>
    <! - END: 6pm Restart->

    <! - EXAMPLE: Looping message, will release every 5 seconds->
    <job id = "12">
    <time> 001200 </time>
    <delay> 000000 </delay>
    <day> 1,2,3,4,5,6,7 </day>
    <loop> 1 </loop>
    <cmd> say-1 Welcome to server Dayz Vladivostok! Ours RK 8902910. Group VK https://vk.com/club78133800. </cmd>
    <cmdtype> 0 </cmdtype>
    </job>





    </Scheduler> With such options the server writes messages earlier on the hour. I can not understand, how it to correct. If who can, help to adjust. Yours faithfully, Boris.
     
  11. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,415
    Likes Received:
    336
    the messages are written 1 hour before they should be? is it that your 2:30 message is written at 1:30?

    if yes, probably your server is not in the same time zone as you. on your server control panel, see if the time is the same as YOUR time.

    ask if you do not understand.

    regards,
    fearless leader.
     
  12. boris62

    boris62 Member

    Joined:
    Jan 12, 2015
    Messages:
    30
    Likes Received:
    0
    Thanks, to you, big, for the answer. You are right, I do not understand, server time is shifted on messages, on an hour. The server is in other time zone. And I need to synchronise time of the server and time of my computer, and I not so understand, how it to make. You can help? Yours faithfully, Boris.
    Only, not at 1.30 and 2.30, and at 1.30, 1.58, and at 02.00.
    Has got confused already, excuse. Restart which should be at 02.00, warns the server at 00.30 that restart will be in half an hour. And actually, restart passes at 02.00.
     
    Last edited: Feb 16, 2015
  13. alexlawson

    alexlawson OpenDayZ Rockstar!

    Joined:
    Jan 5, 2014
    Messages:
    721
    Likes Received:
    116
    All you need to do is remove the ':' and it will go off server time so this
    Code:
        <job id='0'>
            <day>1,2,3,4,5,6,7</day>
            <start>030000</start>
            <runtime>000000</runtime>
            <loop>0</loop>
            <cmd>Server_restart.bat</cmd>
        </job>
    will restart the server after its been up for 3 hours. I think tats what you wanted to know.
     
  14. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,415
    Likes Received:
    336
    ^^^ probably ^^^
     
  15. alexlawson

    alexlawson OpenDayZ Rockstar!

    Joined:
    Jan 5, 2014
    Messages:
    721
    Likes Received:
    116
    Hard to tell with all the commas.
     
  16. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,415
    Likes Received:
    336
    those are extras for you to take home with you in case you run out. Maybe your country gets a punctuation shortage, then what? .. you will be glad to have them then ....
     
  17. boris62

    boris62 Member

    Joined:
    Jan 12, 2015
    Messages:
    30
    Likes Received:
    0
    Hello. Thanks for the answer, but haven't helped. Has made under your recommendation, but messages appear now after restart with delay on half an hour. Yours faithfully, Boris.

    <Scheduler>

    <!-- IMPORTANT: Visit www.ibattle.org for usage guides -->
    <!-- Guide For Using Scheduler System: http://ibattle.org/install-and-configure/setting-up-the-scheduler/ -->

    <!-- 2 Time Formats Can Be Used:
    00:00:00 - HH:MM:SS - Example, 02:30:00 would be 2:30am. Messages using this format are sent based on the node's time. It is recommend to set your ACP profile time to the same timezone as the node.
    000000 - HHMMSS - Example, 003000 Is 30 Minutes From When Server Started
    -->

    <!-- Restart (Every 02:00, 06:00, 10:00, 14:00, 18:00, 22:00 hours) -->

    <!-- START: 10pm Restart -->
    <job id="0">
    <time>003000</time>
    <delay>000000</delay>
    <day>1,2,3,4,5,6,7</day>
    <loop>0</loop>
    <cmd>say -1 Server Restart in 30 minutes </cmd>
    <cmdtype>0</cmdtype>
    </job>

    <job id="1">
    <time>000200</time>
    <delay>000000</delay>
    <day>1,2,3,4,5,6,7</day>
    <loop>0</loop>
    <cmd>say -1 Server Restart in 2 minutes </cmd>
    <cmdtype>0</cmdtype>
    </job>
    <!-- END: 10pm Restart -->

    <!-- START: 2am Restart -->
    <job id="2">
    <time>003000</time>
    <delay>000000</delay>
    <day>1,2,3,4,5,6,7</day>
    <loop>0</loop>
    <cmd>say -1 Server Restart in 30 minutes </cmd>
    <cmdtype>0</cmdtype>
    </job>

    <job id="3">
    <time>000200</time>
    <delay>000000</delay>
    <day>1,2,3,4,5,6,7</day>
    <loop>0</loop>
    <cmd>say -1 Server Restart in 2 minutes </cmd>
    <cmdtype>0</cmdtype>
    </job>
    <!-- END: 2am Restart -->


    <!-- START: 6am Restart -->
    <job id="4">
    <time>003000</time>
    <delay>000000</delay>
    <day>1,2,3,4,5,6,7</day>
    <loop>0</loop>
    <cmd>say -1 Server Restart in 30 minutes </cmd>
    <cmdtype>0</cmdtype>
    </job>

    <job id="5">
    <time>000200</time>
    <delay>000000</delay>
    <day>1,2,3,4,5,6,7</day>
    <loop>0</loop>
    <cmd>say -1 Server Restart in 2 minutes </cmd>
    <cmdtype>0</cmdtype>
    </job>
    <!-- END: 6am Restart -->


    <!-- START: 10am Restart -->
    <job id="6">
    <time>003000</time>
    <delay>000000</delay>
    <day>1,2,3,4,5,6,7</day>
    <loop>0</loop>
    <cmd>say -1 Server Restart in 30 minutes </cmd>
    <cmdtype>0</cmdtype>
    </job>

    <job id="7">
    <time>000200</time>
    <delay>000000</delay>
    <day>1,2,3,4,5,6,7</day>
    <loop>0</loop>
    <cmd>say -1 Server Restart in 2 minutes </cmd>
    <cmdtype>0</cmdtype>
    </job>
    <!-- END: 10am Restart -->


    <!-- START: 2pm Restart -->
    <job id="8">
    <time>003000</time>
    <delay>000000</delay>
    <day>1,2,3,4,5,6,7</day>
    <loop>0</loop>
    <cmd>say -1 Server Restart in 30 minutes </cmd>
    <cmdtype>0</cmdtype>
    </job>

    <job id="9">
    <time>000200</time>
    <delay>000000</delay>
    <day>1,2,3,4,5,6,7</day>
    <loop>0</loop>
    <cmd>say -1 Server Restart in 2 minutes </cmd>
    <cmdtype>0</cmdtype>
    </job>
    <!-- END: 2pm Restart -->


    <!-- START: 6pm Restart -->
    <job id="10">
    <time>003000</time>
    <delay>000000</delay>
    <day>1,2,3,4,5,6,7</day>
    <loop>0</loop>
    <cmd>say -1 Server Restart in 30 minutes </cmd>
    <cmdtype>0</cmdtype>
    </job>

    <job id="11">
    <time>000200</time>
    <delay>000000</delay>
    <day>1,2,3,4,5,6,7</day>
    <loop>0</loop>
    <cmd>say -1 Server Restart in 2 minutes </cmd>
    <cmdtype>0</cmdtype>
    </job>
    <!-- END: 6pm Restart -->

    <!-- EXAMPLE: Looping message, will release every 5 seconds -->
    <job id="12">
    <time>001200</time>
    <delay>000000</delay>
    <day>1,2,3,4,5,6,7</day>
    <loop>1</loop>
    <cmd>say -1 Welcome to server Dayz Vladivostok! Ours RK 8902910. Group VK https://vk.com/club78133800. </cmd>
    <cmdtype>0</cmdtype>
    </job>





    </Scheduler>
     
  18. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,415
    Likes Received:
    336
    time you WANT the restart warning?

    what time does it actually display?

    hiveext.ini time, static or local?
     
  19. boris62

    boris62 Member

    Joined:
    Jan 12, 2015
    Messages:
    30
    Likes Received:
    0
    Yes, I want to show restart preventions. In ini there is local time. Yours faithfully, Boris.
    [Time]
    ;Possible values: Local, Custom, Static
    Type = Local
    ;If using Custom type, offset from UTC in hours (can be negative as well)
    ;Offset = 0
    ;If using Static type (Hour value always the same on every server start), the value (0-24) to set the Hour to
    ;Hour = 24
     
    Last edited: Feb 17, 2015
  20. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,415
    Likes Received:
    336
    and how often do you want your server to restart?
    every 4 hours?
    every 6 hours?

    With all this information, someone can get your scheduler.xml to work correctly.
     

Share This Page