Automatic OS detection for server restart

This commit is contained in:
Wyqer 2019-11-21 17:35:11 +01:00
parent 1a2c24fc45
commit 40fd1af4ef
No known key found for this signature in database
GPG Key ID: D7E2F8BD7F1E48FA
2 changed files with 9 additions and 9 deletions

View File

@ -1,18 +1,17 @@
if (!isDedicated) exitWith {};
private ["_serverDuration","_timeStart","_timeSinceStart","_shutdownSuccess","_timeUntilRestart","_30minspassed","_15minspassed","_5minspassed","_60secondspassed"];
_serverDuration = (KP_liberation_restart * 60 * 60);
diag_log format ["[KP LIBERATION] [RESTART] Restart Timer Set To %1", _serverDuration];
_30minspassed = false;
_15minspassed = false;
_5minspassed = false;
_60secondspassed = false;
private _30minspassed = false;
private _15minspassed = false;
private _5minspassed = false;
private _60secondspassed = false;
_timeStart = diag_tickTime;
private _timeStart = diag_tickTime;
private ["_timeSinceStart","_timeUntilRestart"];
while{true} do
{
_timeSinceStart = diag_tickTime - _timeStart;
@ -57,8 +56,8 @@ while{true} do
diag_log "[KP LIBERATION] [RESTART] Restart timeout elapsed, attempting server shutdown.";
sleep 5;
_myPass = call compile preprocessFileLineNumbers "\userconfig\restart\myPass.hpp";
_shutdownSuccess = _myPass serverCommand "#restart";//you can change with #restartserver if you want to restart the server process(Windows Dedicated Only).
private _myPass = call compile preprocessFileLineNumbers "\userconfig\restart\myPass.hpp";
private _shutdownSuccess = _myPass serverCommand (["#restart", "#restartserver"] select {(productVersion select 6) isEqualTo "Windows"});
if(_shutdownSuccess) then
{

View File

@ -196,6 +196,7 @@ class Missions
* Added: Applied mission parameters are logged in server rpt.
* Updated: Updated CUP presets to be inline with October 2019 stable build of CUP mods. Thanks to [Eogos](https://github.com/Eogos)
* Tweaked: Default blacklist now only holds the static and tent backpacks.
* Tweaked: Scripted server restart now automatically recognizes the OS of the server. More info in the [Wiki article](https://github.com/KillahPotatoes/KP-Liberation/wiki/EN_FAQ#how-does-the-scripted-server-restart-work)
* Fixed: Some CUP presets had free buildable arsenals. Thanks to [Eogos](https://github.com/Eogos)
* Fixed: Wrong boat in CUP USMC Woodland preset. Thanks to [Eogos](https://github.com/Eogos)
* Fixed: Object inits will fire on units not only vehicles.