Sign in to follow this  
Followers 0

Ahoy Server Tools

3 posts in this topic

If any of ya are looking for a Restart.bat file that will restart your server and BEC and keep your server alive if it crashs in that link above there is a A3_Restarter.bat file I added one line of code to allow it to stop and restart the server .. The code looks like this below. Edit it to fit your server and setup the command in BEC to run that Bat file. 

@echo off
tASKkill /im arma3server.exe
REM -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
REM File:			A3_Restarter.bat
REM Version:		V1.5
REM Author:			Unknown
REM Contributers:	Kamaradski
REM Arma3 Server Starter & Restarter script edited by
REM -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

REM =-=-=-=-=-=-=-=-=-=-=-=-=-=- RESTARTER CONFIGURATION -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

REM servername = Name of your server (display purposes & logfile naming)
REM arma3exe = Name of your arma server executable
REM serverpath = Path to your server
REM serverstart = Startup parameters for your server
REM Serverport = Port of your server (display purposes only)
REM Logpath = Path of the logfiles

SET "servername=Server_EU1"
SET "arma3exe=arma3server.exe"
SET "serverpath=C:\Games\A3_EU1"
SET "serverstart= -noPause -noSound -nosplash -cpuCount=4 -name=C:\Games\A3_EU1\BattlEye -profiles=C:\Games\A3_EU1\BattlEye -config=a3config.cfg -cfg=basic.cfg -world=stratis -port=2302"
SET "serverport=2302"
SET "logpath=C:\Games\Tools\A3_Scripts\log

REM =-=-=-=-=-=-=-=-=-=-=-=-=-=- BEC CONFIGURATION -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
REM becpath = Path to BEC installation
REM serverbec = Bec executable for this server (make different copies for each server you run)
REM serverbeccfg = Name of your BEC configuration for this server

SET "becpath=C:\Games\Tools\Bec\"
SET "serverbec=Bec1.exe"
SET "serverbeccfg=Config_server1.cfg"

REM =-=-=-=-=-=-=-=-=-=-=-=-=-=- UNLOCKER CONFIGURATION -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
REM USEUNLOCK = YES to enable the use of the UNlocker, NO to disable us of the UNlocker
REM UNLCKP = Path to unlock.bat

SET "UNLCKP=C:\Games\Tools\MPMissions"

REM =-=-=-=-=-=-=-=-=-=-=-=-=- DO NOT EDIT BELOW HERE -=-=-=-=-=-=-=-=-=-=-=-=-=-

IF NOT EXIST %logpath%\Restarter_%servername%.log ( 
echo. 2>%logpath%\Restarter_%servername%.log 
echo %date% - %time%  -  Created Logfile "Restarter_%servername%.log"
echo %date% - %time%  -  Created Logfile >> %logpath%\Restarter_%servername%.log 2>&1
echo. >> %logpath%\Restarter_%servername%.log

tasklist | findstr /i %serverbec% >NUL 2>>%logpath%\Restarter_%servername%.log
if %errorlevel%==1 goto startserver
ping -n 5 -w 1000 >NUL 2>>%logpath%\Restarter_%servername%.log
goto check

ping %useless% -n 5 -w 1000 >NUL 2>>%logpath%\Restarter_%servername%.log
if defined PIDserver echo %date% - %time%  -  Kill %servername% Server... >> %logpath%\Restarter_%servername%.log 2>&1
if defined PIDserver taskkill /f /pid %PIDserver% >> %logpath%\Restarter_%servername%.log 2>&1
if defined PIDserver set "PIDserver=" 
ping -n 1 -w 1000 >NUL 2>>%logpath%\Restarter_%servername%.log
for /f "delims=" %%l in ('for /f "skip=3 tokens=2" %%p in ^('tasklist /fi "imagename eq %arma3exe%"'^) do @^<NUL set /p "=%%p "') do (
  set "PIDs=%%l" 

echo %date% - %time%  -  Starting: %servername% on Port: %serverport% ...
echo %date% - %time%  -  Starting: %servername% on Port: %serverport% ... >> %logpath%\Restarter_%servername%.log 2>&1
cd /d %serverpath%
start /min .\%arma3exe% %serverstart%
ping -n 1 -w 1000 >NUL 2>>%logpath%\Restarter_%servername%.log

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

if defined PIDserver echo %date% - %time%  -  %servername% started with PID: %PIDserver% >> %logpath%\Restarter_%servername%.log 2>&1
ping -n 60 -w 1000 >NUL 2>>%logpath%\Restarter_%servername%.log
echo %date% - %time%  -  Starting BEC for %servername% Server...
echo %date% - %time%  -  Starting BEC for %servername% Server... >> %logpath%\Restarter_%servername%.log 2>&1
cd /d %becpath%
start /min "%becpath%" "%serverbec%" -f %serverbeccfg%

if /i %USEUNLOCK% == YES (
	ping -n 10 -w 1000 >NUL 2>>%logpath%\Restarter_%servername%.log
	cd "%UNLCKP%"
	start /wait "Unlocking MPMissions" "unlock.bat"
	echo %date% - %time%  -  Unlocker Script executed... >> %logpath%\Restarter_%servername%.log 2>&1
	echo %date% - %time%  -  Unlocker Script executed...

echo %date% - %time%  -  All services started.
echo %date% - %time%  -  All services started. >> %logpath%\Restarter_%servername%.log 2>&1
echo. >> %logpath%\Restarter_%servername%.log

goto check


1 person likes this

Share this post

Link to post
Share on other sites

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.