Seth^^

Windows Start / Restart batch file (without BEC)

23 posts in this topic

ExileServer_system_rcon_thread_check.sqf
 

/**
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
 
private["_restartTime","_restartMessages","_useAutoKick","_kickTime","_lockTime","_uptime","_timeTilRestart","_time","_i"];
_restartTime = _this select 0;
_restartMessages = _this select 1;
_useAutoKick = _this select 2;
_kickTime = _this select 3;
_lockTime = _this select 4;
_uptime = call ExileServer_util_time_uptime;
_timeTilRestart = _restartTime - _uptime;
if (typeName _restartMessages isEqualTo "ARRAY") then
{
if !(_restartMessages isEqualTo []) then
{
{
_time = _x;
if (_timeTilRestart < _time) then
{
if !(ExileSessions isEqualTo []) then
{
["notificationRequest",["RestartWarning",[format["Server restart in %1 min!",_time]]]] call ExileServer_system_network_send_broadcast;
};
ExileServerRestartMessages deleteAt _forEachIndex;
format ["Restart Warrnings for %1min sent",_time] call ExileServer_util_log;
};
}
forEach _restartMessages;
};
};
if (_timeTilRestart < _lockTime) then
{
if !(ExileServerIsLocked) then
{
"#lock" call ExileServer_system_rcon_event_sendCommand;
"Server locked for restart" call ExileServer_util_log;
["notificationRequest",["LockKickWarning",["You will be kicked from the server due to restart."]]] call ExileServer_system_network_send_broadcast;
ExileServerIsLocked = true;
};
if (_timeTilRestart < _kickTime) then
{
if !(ExileServerRestartMode) then
{
call ExileServer_system_rcon_event_kickAllrestart;
"Evryone kicked for restart" call ExileServer_util_log;
call ExileServer_system_rcon_event_clearBuffers;
"Buffers cleared!" call ExileServer_util_log;
for "_i" from 0 to 9 do
{
"SERVER READY FOR RESTART!!" call ExileServer_util_log;
};
ExileServerRestartMode = true;
};
};
};

true

Share this post


Link to post
Share on other sites

I use this script to monitor the server also backup the database every restart/crash and use with BEC Scheduler.xml

@echo off
::CREDITS::Raklatif's Arma2OA Monitor, f3cuk Database backup, juandayz
::CONFIG SETTINGS
set becPath="C:\Servers\Exile\Bec"
set serverPath="C:\Servers\Exile"
set DB_USERNAME="ABCDEFG"
set DB_PASSWORD="*********"
set DB_NAME="exile"
set PATH_TO_BACKUP_FOLDER="C:\Exile_DB_Backup"
set PATH_TO_MYSQL_BIN="C:\Wamp64\bin\mysql\mysql5.7.23\bin"
::END SETTINGS
:arma3server
echo (%time%) initializing script....
echo If you want to close arma3server and this script, close the arma3server window and type Y depending on your language followed by Enter.
timeout /t 1 /nobreak
echo (%time%) connecting to database
timeout /t 1 /nobreak
echo (%time%) Backing up database.
FOR /F "tokens=1-4 DELIMS=/ " %%F IN ('date /T') DO (set v_date=%%F%%G%%H)
FOR /F "tokens=1-4 DELIMS=: " %%F IN ('time /T') DO (set v_time=%%F%%G%%H)
set fname=database_%v_date%_%v_time%.sql
cd %PATH_TO_MYSQL_BIN%
mysqldump.exe -e -u%DB_USERNAME% -p%DB_PASSWORD% %DB_NAME% > %PATH_TO_BACKUP_FOLDER%\%fname%
echo (%time%) DIR %PATH_TO_BACKUP_FOLDER% FILE %fname%
ping 127.0.0.1 -n 5 >NUL
timeout /t 3 /nobreak
echo Watching Exile Server For Crashes/Restarts...
title Exile Server Monitor
cd %serverPath%
echo (%time%) arma3server started.
start "arma3" /min "C:\Servers\Exile\arma3server.exe" -port=2302 -autoInit -noSound -noPause -maxmem=2047 "-config=@ExileServer\config.cfg" "-cfg=@ExileServer\basic.cfg" "-profiles=exileprofile" -name=exileprofile "-servermod=@ExileServer;@infiSTAR_Exile;" "-mod=@Exile;@Lythium;@Jbad;@cba_a3;@cup_weapons;@cup_vehicles;@cup_units;@cup_terrains_maps;@cup_terrains_core;@rhsafrf;@rhsgref;@rhssaf;@rhsusaf;"
cd %becPath%
timeout /t 140 /nobreak
echo (%time%) bec started.
start /wait Bec.exe -f Config.cfg
echo (%time%) WARNING: arma3server or BEC closed or crashed, restarting.
:: KILL SERVICES
timeout /t 3 /nobreak
taskkill /F /IM arma3server.exe
taskkill /F /IM Bec.exe
timeout /t 1 /nobreak
goto arma3server
 

Share this post


Link to post
Share on other sites
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

  • Recently Browsing   0 members

    No registered users viewing this page.