Jump to content
Sign in to follow this  
thec1aw

Looking for a working batch file that will start A3 & Bec

Recommended Posts

I've configured Bec to run on my server. However I'm having trouble getting it to run through my batch file so it starts when the server reboots. Does anyone have a working example on how to do this? This is my current *unworking* batch file.

::Made by eRazeri
@echo off
C:\Windows\System32\mode con cols=50 lines=3 >nul
set /a var=0
:start
echo Running Server
start "" /wait /realtime /affinity FF "F:\SteamLibrary\SteamApps\common\Arma3\arma3server.exe" -ip=74.91.120.149 -port=2302 "-config=server.cfg" "-cfg=basic.cfg" -BEpath=F:\SteamLibrary\SteamApps\common\Arma3\BattlEye -noPause -noSound -nosplash -cpuCount=4  -exThreads=7 
set /a var+=1
cls
echo Server has crashed %var% times, restarting
:: Set path to bec and cd to this directory.
set becpath="F:\Bec\"
cd /d %becpath%
:: start bec
start "" "bec.exe" -f Config.cfg
goto start

Share this post


Link to post
Share on other sites

I found this arma 2 batch file and applied it for my needs.

@echo off

set "arma3=arma3server.exe"
set "useless=127.0.0.1"
set "becpath=F:\BEC\"

set "server1=Arma3 - Port: 2302"
set "server1bec=Bec.exe"
set "server1beccfg=Config.cfg"
set "serverpath1=F:\SteamLibrary\SteamApps\common\Arma3\"
set "serverstart1=-ip=74.91.120.149 -port=2302 "-config=server.cfg" "-cfg=basic.cfg" -BEpath=F:\SteamLibrary\SteamApps\common\Arma3\BattlEye -noPause -noSound -nosplash -cpuCount=4  -exThreads=7 

:check
tasklist | findstr /i Bec.exe > NUL
if %errorlevel%==1 goto startserver1
ping %useless% -n 5 -w 1000 > NUL
goto check


:startserver1
ping %useless% -n 5 -w 1000 > NUL
if defined PIDSERVER1 echo %date% %time%	Kill %server1% Server...
if defined PIDSERVER1 taskkill /f /pid %PIDSERVER1%
if defined PIDSERVER1 set "PIDSERVER1="
ping %useless% -n 1 -w 1000 > NUL
for /f "delims=" %%l in ('for /f "skip=3 tokens=2" %%p in ^('tasklist /fi "imagename eq %arma3%"'^) do @^<NUL set /p "=%%p "') do (
 set "PIDs=%%l"
)

echo %date% %time%	Starting %server1% Server...
cd /d %serverpath1%
start /min arma3server.exe %serverstart1%
ping %useless% -n 1 -w 1000 > NUL

for /f "skip=3 tokens=2" %%p in ('tasklist /fi "imagename eq %arma3%"') do (
 echo %PIDs% | find "%%p" > NUL || if not defined PIDSERVER1 set "PIDSERVER1=%%p"
)

if defined PIDSERVER1 echo %date% %time%	%server1% started with PID: %PIDSERVER1%
ping %useless% -n 10 -w 1000 > NUL
echo %date% %time%	Starting BEC for %server1% Server... 
cd /d %becpath%
start /min "%becpath%" "%server1bec%" -f %server1beccfg%
goto check

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×