BEC Battleye Extended Controls / Server restart monitor

BEC Battleye Extended Controls / Server restart monitor

« posted: Jun 01, 2015, 06:08 PM »
This script will restart both BEC (Battleye Extended Controls) and the Arma 3 server in the case of shutdown.

If you, like me, have been struggling to make your server and BEC work together at restart here is a way of getting that done.

OK, guys...First of all, I did not write this code, I found 2 pieces and merged them together to make it work. It took a bit of trial and error, but it works now with out causing issues with BEC not reaching out for updates. Feel free to use any or all of this to meet your needs.

NOTE: Make sure you insert your BEC and A3 Server paths...

CrashRestartScript.bat
Code: [Select]
::Made by eRazeri
@echo off
:start
::RESTARTING BATTLEYE
set becpath="Your BEC Path"
cd /d %becpath%
::edit your switches below for how you want that to function
start "" /min "Bec.exe" --dsc -f Config.cfg
timeout 3
echo Starting BEC
::RESTARTING SERVER
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 "your A3server.exe Path"
echo Server started succesfully
goto started
:loop
cls
echo Server is already running, running monitoring loop
:started
C:\Windows\System32\timeout /t 1
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

As well, because of this script, I was able to get my Schedule.xml down to 20 actions. 16 messages and 4 shutdown commands:
Code: [Select]
<Scheduler>

<!-- this job will start after 2 minutes and run forever with a 1 hour interval between the jobs -->
<!-- Messages -->
<job id='0'>
<day>1,2,3,4,5,6,7</day>
<start>000120</start>
<runtime>010000</runtime>
<loop>-1</loop>
<cmd>say -1 This server auto restarts 4 times per day, 6:00am, 12:00pm, 6:00pm, 12:00am Eastern Time</cmd>
</job>

<!-- 06:00 restart -->
<job id='1'>
<day>1,2,3,4,5,6,7</day>
<start>05:30:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>say -1 The server will auto restart in 30 minutes.</cmd>
</job>

<job id='2'>
<day>1,2,3,4,5,6,7</day>
<start>05:50:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>say -1 The server will auto restart in 10 minutes.</cmd>
</job>

<job id='3'>
<day>1,2,3,4,5,6,7</day>
<start>05:59:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>say -1 The server will auto restart in 60 seconds.</cmd>
</job>

<!-- 12:00 restart -->
<job id='4'>
<day>1,2,3,4,5,6,7</day>
<start>11:30:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>say -1 The server will auto restart in 30 minutes.</cmd>
</job>

<job id='5'>
<day>1,2,3,4,5,6,7</day>
<start>11:10:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>say -1 The server will auto restart in 10 minutes.</cmd>
</job>

<job id='6'>
<day>1,2,3,4,5,6,7</day>
<start>11:59:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>say -1 The server will auto restart in 60 seconds.</cmd>
</job>

<!-- 6:00 restart -->
<job id='7'>
<day>1,2,3,4,5,6,7</day>
<start>17:30:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>say -1 The server will auto restart in 30 minutes.</cmd>
</job>

<job id='8'>
<day>1,2,3,4,5,6,7</day>
<start>17:50:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>say -1 The server will auto restart in 10 minutes.</cmd>
</job>

<job id='9'>
<day>1,2,3,4,5,6,7</day>
<start>17:59:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>say -1 The server will auto restart in 60 seconds.</cmd>
</job>

<!-- 00:00 restart -->
<job id='10'>
<day>1,2,3,4,5,6,7</day>
<start>23:30:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>say -1 The server will auto restart in 30 minutes.</cmd>
</job>

<job id='11'>
<day>1,2,3,4,5,6,7</day>
<start>23:50:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>say -1 The server will auto restart in 10 minutes.</cmd>
</job>

<job id='12'>
<day>1,2,3,4,5,6,7</day>
<start>23:59:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>say -1 The server will auto restart in 60 seconds.</cmd>
</job>

<job id='13'>
<day>1,2,3,4,5,6,7</day>
<start>000900</start>
<runtime>010000</runtime>
<loop>-1</loop>
<cmd>say -1 Join our Teamspeak @ 66.55.149.29:9455 to team with other players.</cmd>
</job>

<job id='14'>
<day>1,2,3,4,5,6,7</day>
<start>001800</start>
<runtime>010000</runtime>
<loop>-1</loop>
<cmd>say -1 Foul Language will not be tolerated, and will result in a kick or ban. Keep the Global chat clean!</cmd>
</job>

<job id='15'>
<day>1,2,3,4,5,6,7</day>
<start>002700</start>
<runtime>010000</runtime>
<loop>-1</loop>
<cmd>say -1 Hacking and Glitching is an Immediate Player Ban. We are watching you!</cmd>
</job>

<job id='16'>
<day>1,2,3,4,5,6,7</day>
<start>003600</start>
<runtime>010000</runtime>
<loop>-1</loop>
<cmd>say -1 Territory Payouts are now $2500.00 Per and will pay on the hour. The more territories, the more cash.</cmd>
</job>

<!-- Functions -->

<job id='17'>
<day>1,2,3,4,5,6,7</day>
<start>06:00:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>#shutdown</cmd>
</job>

<job id='18'>
<day>1,2,3,4,5,6,7</day>
<start>12:00:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>#shutdown</cmd>
</job>

<job id='19'>
<day>1,2,3,4,5,6,7</day>
<start>18:00:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>#shutdown</cmd>
</job>

<job id='20'>
<day>1,2,3,4,5,6,7</day>
<start>00:00:00</start>
<runtime>000000</runtime>
<loop>0</loop>
<cmd>#shutdown</cmd>
</job>

</Scheduler>

Lastly, I added a shortcut to the Startup folder in Windows 7 for the CrashRestartScript.bat to launch if the Virtual Hardware restarts due to Windows updates or software crashes.

I am running a Windows 7 VM on VMware vSpheer with Teamviewer 10 as my remote tool.

I hope this helps a few noobs like me get a seamless restart command.
  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1085
  • ^_^;;

Re: BEC Battleye Extended Controls / Server restart monitor

« Reply #1 posted: Jun 02, 2015, 09:36 AM »
Mod please move this to Server Hosting =)

- from the grassy knoll -
  • Offline LouD
  • Silent but deadly ;)
  • Moderator
  • Veteran
  • ******
  • Posts: 1415

Re: BEC Battleye Extended Controls / Server restart monitor

« Reply #2 posted: Jun 02, 2015, 11:30 AM »
Moved.
  • Offline Speshals
  • Vyus New Zealand
  • Fresh Spawn
  • *
  • Posts: 11
  • www.vyus.nz

Re: BEC Battleye Extended Controls / Server restart monitor

« Reply #3 posted: Aug 16, 2015, 02:53 AM »
How would I modify to make this work with TADST?