• 0
Sign in to follow this  
Followers 0
Vercetti

Batch File Looping

Question

After a restart, one of my batch files is looping causing it to eat all the server memory up. I used the batch files provided by this thread: http://www.exilemod.com/topic/6357-bec-battleye-extended-controls-setup-with-auto-restarts/

I obviously made the edits to fit my server but here are the batch files:

Server Monitor

@echo off
::IMPORTANT TO NAME IT SO WE CAN KILL IT
title servermonitor.bat
:start
C:\Windows\System32\tasklist /FI "IMAGENAME eq C:\Arma\Server\arma3server.exe" 2>NUL | C:\Windows\System32\find /I /N "C:\Arma\Server\arma3server.exe">NUL
if "%ERRORLEVEL%"=="0" goto loop
echo Server is not running, will be started now 
start "" /min /wait "C:\Arma\Server\restartserver.bat" 
timeout 30
echo Server started succesfully
goto started
:loop
cls
echo Server is already running, running monitoring loop
:started
::THE 80 REFERS TO SECONDS AND HOW OFTEN IT WILL CHECK,YOU CAN SET IT TO WHATEVER YOU WANT. I JUST DONT WANT MY SERVER DOWN FOR MUCH LONGER THAN THAT!
::New error fault kill, will check for err fault and clear it and hopefully restart, a little more promise but no guarantee :)
taskkill /f /im WerFault.exe /fi "WINDOWTITLE eq Arma 3"
C:\Windows\System32\timeout /t 80
C:\Windows\System32\tasklist /FI "IMAGENAME eq C:\Arma\Server\arma3server.exe" 2>NUL | C:\Windows\System32\find /I /N "C:\Arma\Server\arma3server.exe">NUL
if "%ERRORLEVEL%"=="0" goto loop
goto start

Restart Server

@echo off
::MAKE SURE ALL TASKS ARE REALLY STOPPED

taskkill /f /fi "status eq not responding" /im arma3server.exe
taskkill /f /im arma3server.exe
timeout 1

::IF YOU PLAY ON SAME PC AS SERVER, SOMETIMES RESTARTS GET HUNG UP BECAUSE OF IT SO MAKE SURE TO KILL CLIENTSIDE TOO, I DONT, BUT JUST IN CASE YOU DO

taskkill /f /fi "status eq not responding" /im arma3.exe
taskkill /f /im arma3.exe
timeout 1

:: KILL BATTLEYE IF IT ISN'T ALREADY
taskkill /im Bec.exe

::SHUTDOWN SERVERMONITOR IF IT IS ALREADY RUNNING - WE RESTART IT AT THE END OF THIS
taskkill /f /im cmd.exe /fi "windowtitle eq servermonitor.bat
echo Make sure all is clear

echo Restarting Battleye

::RESTARTING BATTLEYE
set becpath="C:\Arma\Bec\"
cd /d %becpath%
start "" /min "Bec.exe" --dsc Config.cfg
timeout 3
echo Battleye has started.. 
echo.
echo.
echo Starting ARMA 3 Server...

::RESTARTING THE ARMA 3 SERVER BE SURE TO EDIT THIS TO YOUR SERVER .EXE LOCATION -NOTE ALSO THIS IS WHERE YOU DEFINE WHERE YOU CONFIG.CFG IS
cd C:\Arma\Server\
timeout 3
start "Arma3" /min /wait C:\Arma\Server\arma3server.exe -mod=@Exile;@CUP_Terrains_Core;@CUP_Weapons;@CBA_A3;@CUP_Vehicles;@CUP_Units;@CUP_Terrains_Maps -servermod=@ExileServer;@infiSTAR_Exile -config=C:\Arma\Server\@ExileServer\config.cfg -port=45550 -profiles=SC -cfg=C:\Arma\Server\@ExileServer\basic.cfg -bepath=C:\Arma\Server\battleye -name=SC -autoinit -loadMissionToMemory
timeout 6
echo ARMA 3 Server has started

:: THIS RUNS THE SERVER MONITOR FOR YOU SO YOU DON'T FORGET
set ServerMonitorPath="C:\Arma\Server\"
cd /d %ServerMonitorPath%
start "" "servermonitor.bat"
echo Server Monitor has started. Have Fun
timeout 5
exit 

Stop Server

@echo off
::KILL ARMA3 SERVER
taskkill /f /fi "status eq not responding" /im arma3server.exe
taskkill /f /im C:\Arma\Server\arma3server.exe
timeout 1
::DOUBLE CHECK KILL
taskkill /f /fi "status eq not responding" /im arma3server.exe
taskkill /f /im C:\Arma\Server\arma3server.exe
timeout 1
:: KILL BATTLEYE
taskkill /im C:\Arma\Bec\Bec.exe
timeout 1

Any ideas what is wrong or?

Edited by Vercetti

Share this post


Link to post
Share on other sites

0 answers to this question

There have been no answers to this question yet

Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.