Jump to content
  • 0
Sign in to follow this  
Friendly

Bec scheduler not executing .bat file!

Question

I know there are plenty more of these but please take a look at this as I dont know what the problem may be. The problem doesn't seem to be the @Startup.bat as it runs perfectly fine when I run it. I think it has something to do with the format in which I put the patch on the scheduler.xml. I am wondering if it has something to do with being on a different drive because when I type cd D:\Program Files (x86)\Steam\steamapps\common\Arma 3 in CMD it wont go to the D drive but works when I put cd C:\Program Files (x86)\Steam\steamapps\common\Arma 3

 

 Scheduler.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 
<Scheduler>
       
        <!-- *** RESTARTS *** -->
        <!-- 30 min to the 800 restart -->
		<job id="0">
                <start>073000</start>
                <day>1,2,3,4,5,6,7</day>
		<runtime>000000</runtime>
                <loop>0</loop>
                <cmd>say -1 AUTO SERVER RESTART IN 30 MINUTES!</cmd>
                <cmdtype>0</cmdtype>                   
        </job>
		
        <job id="1">
                <start>075500</start>                
                <day>1,2,3,4,5,6,7</day>
		<runtime>000000</runtime>
                <loop>0</loop>
                <cmd>say -1 AUTO SERVER RESTART IN 5 MINUTES!</cmd>
                <cmdtype>0</cmdtype>                   
        </job>
       
        <job id="2">
                <start>075900</start>                
                <day>1,2,3,4,5,6,7</day>
		<runtime>000000</runtime>
                <loop>0</loop>
                <cmd>say -1 AUTO SERVER RESTART IN 1 MINUTE!</cmd>
                <cmdtype>0</cmdtype>                   
        </job>
		
	<job id="3">
	        <day>1,2,3,4,5,6,7</day>
	        <start>080000</start>
	        <runtime>000000</runtime>
	        <loop>0</loop>
		<cmd>D:\Program Files (x86)\Steam\SteamApps\common\Arma 3\@Startup.bat</cmd>
		<cmdtype>1</cmdtype>
        </job>  
       
        <!-- *** RESTARTS *** -->
        <!-- 30 min to the 1400 restart -->
	<job id="4">
                <start>133000</start>
                <day>1,2,3,4,5,6,7</day>
		<runtime>000000</runtime>
                <loop>0</loop>
                <cmd>say -1 AUTO SERVER RESTART IN 30 MINUTES!</cmd>
                <cmdtype>0</cmdtype>                   
        </job>
		
        <job id="5">
                <start>135500</start>
                <day>1,2,3,4,5,6,7</day>
		<runtime>000000</runtime>
                <loop>0</loop>
                <cmd>say -1 AUTO SERVER RESTART IN 5 MINUTES!</cmd>
                <cmdtype>0</cmdtype>                   
        </job>
       
        <job id="6">
                <start>135900</start>
                <day>1,2,3,4,5,6,7</day>
		<runtime>000000</runtime>
                <loop>0</loop>
                <cmd>say -1 AUTO SERVER RESTART IN 1 MINUTE!</cmd>
                <cmdtype>0</cmdtype>                   
        </job>  
		
	<job id="7">
		<day>1,2,3,4,5,6,7</day>
		<start>140000</start>
		<runtime>000000</runtime>
		<loop>0</loop>
		<cmd>D:\Program Files (x86)\Steam\SteamApps\common\Arma 3\@Startup.bat</cmd>
		<cmdtype>1</cmdtype>
	</job>  
		
        <!-- *** RESTARTS *** -->
        <!-- 30 min to the 2000 restart -->
	    <job id="8">
                <start>193000</start>
                <day>1,2,3,4,5,6,7</day>
		<runtime>000000</runtime>
                <loop>0</loop>
                <cmd>say -1 AUTO SERVER RESTART IN 30 MINUTES!</cmd>
                <cmdtype>0</cmdtype>                   
        </job>
	
        <job id="9">
                <start>195500</start>
                <day>1,2,3,4,5,6,7</day>
		<runtime>000000</runtime>
                <loop>0</loop>
                <cmd>say -1 AUTO SERVER RESTART IN 5 MINUTES!</cmd>
                <cmdtype>0</cmdtype>                   
        </job>
       
        <job id="10">
                <start>195900</start>
                <day>1,2,3,4,5,6,7</day>
		<runtime>000000</runtime>
                <loop>0</loop>
                <cmd>say -1 AUTO SERVER RESTART IN 1 MINUTE!</cmd>
                <cmdtype>0</cmdtype>                   
        </job>  
		
	<job id="11">
		<day>1,2,3,4,5,6,7</day>
		<start>200000</start>
		<runtime>000000</runtime>
		<loop>0</loop>
		<cmd>D:\Program Files (x86)\Steam\SteamApps\common\Arma 3\@Startup.bat</cmd>
		<cmdtype>1</cmdtype>
	</job>  
		
 
        <!-- *** RESTARTS *** -->
        <!-- 30 min to the 0200 restart -->
		<job id="12">
                <start>013000</start>
                <day>1,2,3,4,5,6,7</day>
		<runtime>000000</runtime>
                <loop>0</loop>
                <cmd>say -1 AUTO SERVER RESTART IN 30 MINUTES!</cmd>
                <cmdtype>0</cmdtype>                   
        </job>
		
		<job id="13">
                <start>015500</start>
                <day>1,2,3,4,5,6,7</day>
		<runtime>000000</runtime>
                <loop>0</loop>
                <cmd>say -1 AUTO SERVER RESTART IN 5 MINUTES!</cmd>
                <cmdtype>0</cmdtype>                   
        </job>
       
        <job id="14">
                <start>015900</start>
                <day>1,2,3,4,5,6,7</day>
		<runtime>000000</runtime>
                <loop>0</loop>
                <cmd>say -1 AUTO SERVER RESTART IN 1 MINUTE!</cmd>
                <cmdtype>0</cmdtype>                   
        </job>
		
				
	<job id="15">
		<day>1,2,3,4,5,6,7</day>
		<start>020000</start>
		<runtime>000000</runtime>
		<loop>0</loop>
		<cmd>D:\Program Files (x86)\Steam\SteamApps\common\Arma 3\@Startup.bat</cmd>
		<cmdtype>1</cmdtype>
	</job>  
		
	<job id='16'>
		<day>1,2,3,4,5,6,7</day>
		<start>001000</start>
		<runtime>013000</runtime>
		<loop>-1</loop>
		<cmd>say -1 ***Welcome to BTK Community hosted Epoch Server! The admins on here are active and if you have a problem just come into our Teamspeak! TS ts.btkgaming.com***We are new and need your help to keep the server running! Please help server cost by donating @ BTKGaming.com***</cmd>
	</job>
		
	<job id='17'>
		<day>1,2,3,4,5,6,7</day>
		<start>010000</start>
		<runtime>010000</runtime>
		<loop>-1</loop>
		<cmd>D:\Program Files (x86)\Steam\steamapps\common\Arma 3\Tools\log-rotator.cmd</cmd>
		<cmdtype>1</cmdtype>
	</job>
 
</Scheduler>




@Startup.bat

@echo off
:: =================CONFIGURATION =======================================================================
::=========================================================================================================================
::Set the path to your servers main directory, usally your Arma 3 directory
set serverdir=D:\Program Files (x86)\Steam\SteamApps\common\Arma 3\
::=========================================================================================================================
:: Set the name of your arma2oaserver.exe if you have a custom one , if its default just put arma2oaserver.exe
set serverEXE=arma3server.exe
::=========================================================================================================================
:: Set the name of the folder that contains your HiveExt,config.cfg,BattleEye etc
set serverprof=SC
::=========================================================================================================================
:: Set the path to your BEC directory for this server
set becdir=D:\BEC
::=========================================================================================================================
:: Set the name of your BEC.exe
set becEXE=Bec.exe
::=========================================================================================================================
:: Set the name of your servers config file
set config=config.cfg
::=========================================================================================================================
:: your Servers Port
set port=2302
::=========================================================================================================================
::The name of the mod you are running, Seperate mods with ;  Ex. @DayZ_Epoch;@DayZ_Namalsk
set [email protected];@EpochHive;
::=========================================================================================================================


::=========================================================================================================================
echo KILLING servers
::=========================================================================================================================
set serverkill="%serverdir%"
cd /d %serverkill%
taskkill /im %serverEXE% /F
::=========================================================================================================================
echo KILLING BEC
::=========================================================================================================================
echo Kill Bec.exe
set beckill="%becdir%"
cd /d %beckill%
taskkill /im %becEXE% /F
timeout 3
::=========================================================================================================================
echo cleaning logs....
::=========================================================================================================================
cd D:\Program Files (x86)\Steam\steamapps\common\Arma 3\Tools
start "" "log-rotator.cmd"
echo Done!
timeout 5
::=========================================================================================================================
echo Starting the Server
::=========================================================================================================================
set armapath="%serverdir%"
cd /d %armapath%
start "" "%serverEXEdir%%serverEXE%" -server  -port=%port% %launch% -profiles=%serverprof%  -config=%serverprof%\%config%  -mod=%mod%;%hivedir%
::=========================================================================================================================
echo Starting Bec
::=========================================================================================================================
timeout 3
:: start bec
set becpath="%becdir%"
cd /d %becpath%
start "" "%becEXE%" -f Config.cfg
echo Server Started 100%
cls
@exit

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Basically you have a batchfile that starts the game, then start /w BEC

When BEC closes the game it also shutsdown itself and restarts the game.

 

here's my batch file and scheduler :

 

game starter : (epoch.cmd)

 

:start
c:
cd "C:\Program Files (x86)\Steam\SteamApps\common\Arma 3"
taskkill /f /im arma3server.exe
timeout 5
start Tools\log-rotator.cmd
start "arma3" "arma3server.exe" -port=2324 -malloc=system -config=SC\config.cfg -ip=192.168.2.5 -profiles=SC -cfg=SC\basic.cfg [email protected];@EpochHive;
timeout 20
cd \bec
start /w bec.exe -f Config.cfg
goto :start

 

Scheduler :

 

<?xml version="1.0"?>
<Scheduler>
    <job id="0">
        <time>01:50:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 10 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="1">
        <time>01:55:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 5 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="2">
        <time>01:59:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 1 minutes this server will perform an automated reboot, get safe NOW.</cmd>
        <cmdtype>0</cmdtype>    
    </job>

    <job id="3">
        <time>02:00:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>#shutdown</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="4">
        <time>04:50:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 10 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="5">
        <time>04:55:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 5 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="6">
        <time>04:59:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 1 minutes this server will perform an automated reboot, get safe NOW.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="7">
        <time>05:00:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>#shutdown</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="8">
<time>005000</time>
<delay>000000</delay>
        <day>1,2,3,4,5,6,7</day>
        <loop>1</loop>
        <cmd>say -1 Welcome to GOB/TZW Epoch..This server restarts every 3 hours with 10 minute warnings.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="9">
        <time>07:50:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 10 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="10">
        <time>07:55:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 5 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="11">
        <time>07:59:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 1 minute this server will perform an automated reboot, get safe NOW.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="12">
        <time>08:00:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>#shutdown</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="13">
        <time>10:50:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 10 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="14">
        <time>10:55:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 5 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="15">
        <time>10:59:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 1 minutes this server will perform an automated reboot, get safe NOW.</cmd>
        <cmdtype>0</cmdtype>    
    </job>

    <job id="16">
        <time>11:00:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>#shutdown</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="17">
        <time>13:50:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 10 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="18">
        <time>13:55:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 5 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="19">
        <time>13:59:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 1 minutes this server will perform an automated reboot, get safe NOW.</cmd>
        <cmdtype>0</cmdtype>    
    </job>

    <job id="20">
        <time>14:00:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>#shutdown</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="21">
        <time>16:50:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 10 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="22">
        <time>16:55:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 5 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="23">
        <time>16:59:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 1 minutes this server will perform an automated reboot, get safe NOW.</cmd>
        <cmdtype>0</cmdtype>    
    </job>

    <job id="24">
        <time>17:00:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>#shutdown</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="25">
        <time>19:50:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 10 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="26">
        <time>19:55:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 5 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="27">
        <time>19:59:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 1 minutes this server will perform an automated reboot, get safe NOW.</cmd>
        <cmdtype>0</cmdtype>    
    </job>

    <job id="28">
        <time>20:00:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>#shutdown</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="29">
        <time>22:50:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 10 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="30">
        <time>22:55:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 5 minutes this server will perform an automated reboot.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="31">
        <time>22:59:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>say -1 In 1 minutes this server will perform an automated reboot, get safe NOW.</cmd>
        <cmdtype>0</cmdtype>    
    </job>

    <job id="32">
        <time>23:00:00</time>
        <day>1,2,3,4,5,6,7</day>
        <loop>0</loop>
        <cmd>#shutdown</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="33">
<time>004000</time>
<delay>000000</delay>
        <day>1,2,3,4,5,6,7</day>
        <loop>1</loop>
        <cmd>say -1 Server teamspeak : ts.is-leet.com</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="34">
<time>003500</time>
<delay>000000</delay>
        <day>1,2,3,4,5,6,7</day>
        <loop>1</loop>
        <cmd>say -1 No camping at Safe Zones. Punishment is a swift ban.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
    <job id="35">
<time>003500</time>
<delay>000000</delay>
        <day>1,2,3,4,5,6,7</day>
        <loop>1</loop>
        <cmd>say -1 No Building at military compounds or airfields.</cmd>
        <cmdtype>0</cmdtype>    
    </job>
</Scheduler>

Share this post


Link to post
Share on other sites
  • 0

Is it executing the scheduler.xml?

Are there any erros shown?

No errors shown and it is running all of the jobs.

the scheduler.xml is sending the restart msgs and such just not executing the bat files. It does execute the rotate logs bat file but only when I first start it, it does not restart the server just displays the msgs.

Share this post


Link to post
Share on other sites
  • 0

I am wondering if it has something to do with being on a different drive because when I type cd D:\Program Files (x86)\Steam\steamapps\common\Arma 3 in CMD it wont go to the D drive but works when I put cd C:\Program Files (x86)\Steam\steamapps\common\Arma 3

Share this post


Link to post
Share on other sites
  • 0

Working directory / active directory.

 

I'd say : put in the drive too in your batch file and see from there.

 

so : instead of "CD D:\here" you do :

 

D:

cd "\here"

 

C:

cd '\there"

 

That makes sure your active directory is ALSO properly done.

 

Remember, when you're on C: and type cd "d:\here" your command prompt doesn't go there. It just sets the active directory for D: to a new one, but stays on C:

Share this post


Link to post
Share on other sites
  • 0

ENSURE YOU KILL YOUR SERVER  i use a batch file like so 

 

@echo off
TIMEOUT 25
tASKkill /im arma3server.exe
 
 
and my batch to start the server is so
 
 
@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 Server monitored is not running, will be started now 
start "" /wait "D:\Games\dedicated\arma3server.exe" [email protected];@EpochHive; -config=D:\Games\dedicated\SC\config.cfg -port=2302 -profiles=SC -cfg=d:\gAMES\dedicated\SC\basic.cfg -name=SC
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 arma3server.exe" 2>NUL | C:\Windows\System32\find /I /N "arma3server.exe">NUL
if "%ERRORLEVEL%"=="0" goto loop
goto start
 
 
this also restarts server if it crashes

Share this post


Link to post
Share on other sites
  • 0
4 - Keep in mind that the CWD (Current Work Directory) your bat|cmd script or program will have is the same as your Bec install.
  Let say the path you have your Bec installed is at (C:\Tools\Bec).
  This is and will be the CWD of your script even if its located in C:\Scripts\Myfile.bat or some other place.
  
  Depending on your script and what it does, you might need to set a new work-dir by editing your script with something like:
  ::--------------------
  set NewCWD="C:\Scripts\"
       cd /d %NewCWD%
  
  do stuff
  ::--------------------

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...