auto restart server
this script auto restart the mission every 3hrs and use the liberation notification system to inform players, you can use #restart or #restartserver (Windows Dedicated Only this restrat the arma3server process). To Do: add param to turn on/off the auto-restart add param to set time until restart (1-3-6hrs) if anyone want to help me :)
This commit is contained in:
parent
fef06e91ee
commit
2be7a0e0d5
|
@ -25,6 +25,7 @@ switch (KP_liberation_preset) do {
|
|||
|
||||
if (isServer) then {
|
||||
[] call compileFinal preprocessFileLineNumbers "scripts\server\init_server.sqf";
|
||||
ExecVM "server_restart.sqf";
|
||||
};
|
||||
|
||||
if (!isDedicated && !hasInterface && isMultiplayer) then {
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,83 @@
|
|||
ServerDuration = (3*60*60); // Timer , Default is 10800 seconds (3 Hours)
|
||||
DebugServerDuration = (20 * 20);// Debug Timer
|
||||
|
||||
private ["_timeStart","_timeSinceStart","_shutdownSuccess","_isDebug","_timeUntilRestart","_30minspassed","_15minspassed","_5minspassed","_60secondspassed"];
|
||||
|
||||
_isDebug = false;
|
||||
|
||||
if(_isDebug) then
|
||||
{
|
||||
ServerDuration = DebugServerDuration;
|
||||
};
|
||||
|
||||
_30minspassed = false;
|
||||
_15minspassed = false;
|
||||
_5minspassed = false;
|
||||
_60secondspassed = false;
|
||||
|
||||
_timeStart = diag_tickTime;
|
||||
|
||||
while{true} do
|
||||
{
|
||||
_timeSinceStart = diag_tickTime - _timeStart;
|
||||
_timeUntilRestart = ServerDuration - _timeSinceStart;
|
||||
|
||||
if(_isDebug) then
|
||||
{
|
||||
diag_log format ["Time Since Start: %1, Time Until Restart: %2", _timeSinceStart, _timeUntilRestart];
|
||||
};
|
||||
|
||||
switch true do
|
||||
{
|
||||
case ((_timeUntilRestart < (1 * 60)) && !_60secondspassed) :
|
||||
{
|
||||
["lib_restart_60_s"] remoteExecCall ["BIS_fnc_showNotification"];
|
||||
diag_log "60 seconds until server restart.";
|
||||
_60secondspassed = true;
|
||||
_5minspassed = true;
|
||||
_15minspassed = true;
|
||||
_30minspassed = true;
|
||||
};
|
||||
case ((_timeUntilRestart < (5 * 60)) && !_5minspassed) :
|
||||
{
|
||||
["lib_restart_5_min"] remoteExecCall ["BIS_fnc_showNotification"];
|
||||
diag_log "5 minutes until server restart.";
|
||||
_5minspassed = true;
|
||||
_15minspassed = true;
|
||||
_30minspassed = true;
|
||||
};
|
||||
case ((_timeUntilRestart < (15 * 60)) && !_15minspassed) :
|
||||
{
|
||||
["lib_restart_15_min"] remoteExecCall ["BIS_fnc_showNotification"];
|
||||
diag_log "15 minutes until server restart.";
|
||||
_15minspassed = true;
|
||||
_30minspassed = true;
|
||||
};
|
||||
case ((_timeUntilRestart < (30 * 60)) && !_30minspassed) :
|
||||
{
|
||||
["lib_restart_30_min"] remoteExecCall ["BIS_fnc_showNotification"];
|
||||
diag_log "30 minutes until server restart.";
|
||||
_30minspassed = true;
|
||||
};
|
||||
};
|
||||
|
||||
if(_timeSinceStart > ServerDuration) then
|
||||
{
|
||||
diag_log "Restart timeout elapsed, attempting server shutdown.";
|
||||
sleep 5;
|
||||
if isServer then {
|
||||
_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).
|
||||
};
|
||||
if(_shutdownSuccess) then
|
||||
{
|
||||
diag_log "Shutting down server!";
|
||||
}
|
||||
else
|
||||
{
|
||||
diag_log "Shutdown failed!";
|
||||
};
|
||||
|
||||
};
|
||||
sleep 15;
|
||||
};
|
|
@ -4254,5 +4254,25 @@
|
|||
<Italian>completamente distrutto</Italian>
|
||||
<Chinesesimp>完全损毁</Chinesesimp>
|
||||
</Key>
|
||||
<Key ID="STR_NOTIFICATION_RESTART_TITLE">
|
||||
<Original>SERVER RESTART NOTIFICATION</Original>
|
||||
<Italian>NOTIFICA RESTART SERVER</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_NOTIFICATION_RESTART_SECOND">
|
||||
<Original>The server will restart in less than 60 seconds!</Original>
|
||||
<Italian>Il server si riavvierà tra meno di 60 secodni!</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_NOTIFICATION_RESTART_FIVE">
|
||||
<Original>The server will restart in less than 5 minutes!</Original>
|
||||
<Italian>Il server si riavvierà tra meno di 5 minuti!</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_NOTIFICATION_RESTART_FIFTEEN">
|
||||
<Original>The server will restart in less than 15 minutes!</Original>
|
||||
<Italian>Il server si riavvierà tra meno di 15 minuti!</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_NOTIFICATION_RESTART_THIRTY">
|
||||
<Original>The server will restart in less than 30 minutes!</Original>
|
||||
<Italian>Il server si riavvierà tra meno di 30 minuti!</Italian>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
|
|
|
@ -1,145 +1,151 @@
|
|||
class CfgNotifications
|
||||
{
|
||||
class lib_default_notification {
|
||||
duration = 10;
|
||||
soundClose = "defaultNotificationClose";
|
||||
colorIconPicture[] = {1,1,1,1};
|
||||
colorIconText[] = {1,1,1,1};
|
||||
priority = 5;
|
||||
};
|
||||
class lib_sector_captured : lib_default_notification
|
||||
{
|
||||
class CfgNotifications {
|
||||
class lib_default_notification {
|
||||
duration = 10;
|
||||
soundClose = "defaultNotificationClose";
|
||||
colorIconPicture[] = { 1, 1, 1, 1 };
|
||||
colorIconText[] = { 1, 1, 1, 1 };
|
||||
priority = 5;
|
||||
};
|
||||
class lib_sector_captured : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_SECTORCAPTURED_TITLE;
|
||||
description = $STR_NOTIFICATION_SECTORCAPTURED_TEXT;
|
||||
description = $STR_NOTIFICATION_SECTORCAPTURED_TEXT;
|
||||
iconPicture = "res\notif\ui_notif_sec_cap.paa";
|
||||
color[] = {0,1,0,1};
|
||||
sound = "taskSucceeded";
|
||||
color[] = { 0, 1, 0, 1 };
|
||||
sound = "taskSucceeded";
|
||||
};
|
||||
class lib_sector_attacked : lib_default_notification
|
||||
{
|
||||
class lib_sector_attacked : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_SECTORATTACKED_TITLE;
|
||||
description = $STR_NOTIFICATION_SECTORATTACKED_TEXT;
|
||||
description = $STR_NOTIFICATION_SECTORATTACKED_TEXT;
|
||||
iconPicture = "res\notif\ui_notif_sec_una.paa";
|
||||
color[] = {1,1,0,1};
|
||||
sound = "taskCanceled";
|
||||
color[] = { 1, 1, 0, 1 };
|
||||
sound = "taskCanceled";
|
||||
};
|
||||
class lib_sector_lost : lib_default_notification
|
||||
{
|
||||
class lib_sector_lost : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_SECTORLOST_TITLE;
|
||||
description = $STR_NOTIFICATION_SECTORLOST_TEXT;
|
||||
description = $STR_NOTIFICATION_SECTORLOST_TEXT;
|
||||
iconPicture = "res\notif\ui_notif_sec_los.paa";
|
||||
color[] = {1,0,0,1};
|
||||
sound = "taskFailed";
|
||||
color[] = { 1, 0, 0, 1 };
|
||||
sound = "taskFailed";
|
||||
};
|
||||
class lib_sector_safe : lib_default_notification
|
||||
{
|
||||
class lib_sector_safe : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_SECTORSAFE_TITLE;
|
||||
description = $STR_NOTIFICATION_SECTORSAFE_TEXT;
|
||||
description = $STR_NOTIFICATION_SECTORSAFE_TEXT;
|
||||
iconPicture = "res\notif\ui_notif_sec_saf.paa";
|
||||
color[] = {0,0.35,1,1};
|
||||
sound = "taskUpdated";
|
||||
priority = 3;
|
||||
color[] = { 0, 0.35, 1, 1 };
|
||||
sound = "taskUpdated";
|
||||
priority = 3;
|
||||
};
|
||||
class lib_fob_built : lib_default_notification
|
||||
{
|
||||
title = $STR_NOTIFICATION_FOBBUILT_TITLE;
|
||||
description = $STR_NOTIFICATION_FOBBUILT_TEXT;
|
||||
class lib_fob_built : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_FOBBUILT_TITLE;
|
||||
description = $STR_NOTIFICATION_FOBBUILT_TEXT;
|
||||
iconPicture = "res\notif\ui_notif_fob_new.paa";
|
||||
color[] = {0,0.35,1,1};
|
||||
sound = "taskUpdated";
|
||||
color[] = { 0, 0.35, 1, 1 };
|
||||
sound = "taskUpdated";
|
||||
};
|
||||
class lib_fob_safe : lib_default_notification
|
||||
{
|
||||
title = $STR_NOTIFICATION_FOBSAFE_TITLE;
|
||||
description = $STR_NOTIFICATION_FOBSAFE_TEXT;
|
||||
class lib_fob_safe : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_FOBSAFE_TITLE;
|
||||
description = $STR_NOTIFICATION_FOBSAFE_TEXT;
|
||||
iconPicture = "res\notif\ui_notif_fob_sec.paa";
|
||||
color[] = {0,0.35,1,1};
|
||||
sound = "taskUpdated";
|
||||
priority = 3;
|
||||
color[] = { 0, 0.35, 1, 1 };
|
||||
sound = "taskUpdated";
|
||||
priority = 3;
|
||||
};
|
||||
class lib_fob_attacked : lib_default_notification
|
||||
{
|
||||
title = $STR_NOTIFICATION_FOBATTACKED_TITLE;
|
||||
description = $STR_NOTIFICATION_FOBATTACKED_TEXT;
|
||||
class lib_fob_attacked : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_FOBATTACKED_TITLE;
|
||||
description = $STR_NOTIFICATION_FOBATTACKED_TEXT;
|
||||
iconPicture = "res\notif\ui_notif_fob_und.paa";
|
||||
color[] = {1,1,0,1};
|
||||
sound = "taskCanceled";
|
||||
color[] = { 1, 1, 0, 1 };
|
||||
sound = "taskCanceled";
|
||||
};
|
||||
class lib_fob_lost : lib_default_notification
|
||||
{
|
||||
title = $STR_NOTIFICATION_FOBLOST_TITLE;
|
||||
description = $STR_NOTIFICATION_FOBLOST_TEXT;
|
||||
class lib_fob_lost : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_FOBLOST_TITLE;
|
||||
description = $STR_NOTIFICATION_FOBLOST_TEXT;
|
||||
iconPicture = "res\notif\ui_notif_fob_los.paa";
|
||||
color[] = {1,0,0,1};
|
||||
sound = "taskFailed";
|
||||
color[] = { 1, 0, 0, 1 };
|
||||
sound = "taskFailed";
|
||||
};
|
||||
class lib_battlegroup : lib_default_notification
|
||||
{
|
||||
title = $STR_NOTIFICATION_BATTLEGROUP_TITLE;
|
||||
description = $STR_NOTIFICATION_BATTLEGROUP_TEXT;
|
||||
class lib_battlegroup : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_BATTLEGROUP_TITLE;
|
||||
description = $STR_NOTIFICATION_BATTLEGROUP_TEXT;
|
||||
iconPicture = "res\notif\ui_notif_bgp.paa";
|
||||
color[] = {1,0,0,1};
|
||||
sound = "taskFailed";
|
||||
color[] = { 1, 0, 0, 1 };
|
||||
sound = "taskFailed";
|
||||
};
|
||||
class lib_incoming : lib_battlegroup
|
||||
{
|
||||
description = $STR_NOTIFICATION_INCOMING_TEXT;
|
||||
class lib_incoming : lib_battlegroup {
|
||||
description = $STR_NOTIFICATION_INCOMING_TEXT;
|
||||
};
|
||||
class lib_intel : lib_default_notification
|
||||
{
|
||||
title = $STR_NOTIFICATION_INTEL_TITLE;
|
||||
class lib_intel : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_INTEL_TITLE;
|
||||
iconPicture = "res\notif\ui_notif_int.paa";
|
||||
color[] = {0,0.35,1,1};
|
||||
sound = "taskUpdated";
|
||||
color[] = { 0, 0.35, 1, 1 };
|
||||
sound = "taskUpdated";
|
||||
};
|
||||
class lib_intel_prisoner : lib_intel
|
||||
{
|
||||
description = $STR_NOTIFICATION_PRISONER_TEXT;
|
||||
};
|
||||
class lib_intel_document : lib_intel
|
||||
{
|
||||
description = $STR_NOTIFICATION_DOCUMENT_TEXT;
|
||||
class lib_intel_prisoner : lib_intel {
|
||||
description = $STR_NOTIFICATION_PRISONER_TEXT;
|
||||
};
|
||||
class lib_intel_fob : lib_intel
|
||||
{
|
||||
description = $STR_NOTIFICATION_FOB_TEXT;
|
||||
class lib_intel_document : lib_intel {
|
||||
description = $STR_NOTIFICATION_DOCUMENT_TEXT;
|
||||
};
|
||||
class lib_intel_convoy : lib_intel
|
||||
{
|
||||
description = $STR_NOTIFICATION_CONVOY_SPOTTED_TEXT;
|
||||
class lib_intel_fob : lib_intel {
|
||||
description = $STR_NOTIFICATION_FOB_TEXT;
|
||||
};
|
||||
class lib_secondary_fob_destroyed : lib_default_notification
|
||||
{
|
||||
title = $STR_NOTIFICATION_SECONDARY_TITLE;
|
||||
description = $STR_NOTIFICATION_SECONDARY_TEXT;
|
||||
class lib_intel_convoy : lib_intel {
|
||||
description = $STR_NOTIFICATION_CONVOY_SPOTTED_TEXT;
|
||||
};
|
||||
class lib_secondary_fob_destroyed : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_SECONDARY_TITLE;
|
||||
description = $STR_NOTIFICATION_SECONDARY_TEXT;
|
||||
iconPicture = "res\notif\ui_notif_sob.paa";
|
||||
color[] = {0,1,0,1};
|
||||
sound = "taskSucceeded";
|
||||
color[] = { 0, 1, 0, 1 };
|
||||
sound = "taskSucceeded";
|
||||
};
|
||||
class lib_secondary_convoy_destroyed : lib_secondary_fob_destroyed
|
||||
{
|
||||
description = $STR_NOTIFICATION_CONVOY_DESTROYED_TEXT;
|
||||
class lib_secondary_convoy_destroyed : lib_secondary_fob_destroyed {
|
||||
description = $STR_NOTIFICATION_CONVOY_DESTROYED_TEXT;
|
||||
};
|
||||
class lib_reinforcements : lib_default_notification
|
||||
{
|
||||
title = $STR_NOTIFICATION_REINFORCEMENTS_TITLE;
|
||||
description = $STR_NOTIFICATION_REINFORCEMENTS_TEXT;
|
||||
class lib_reinforcements : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_REINFORCEMENTS_TITLE;
|
||||
description = $STR_NOTIFICATION_REINFORCEMENTS_TEXT;
|
||||
iconPicture = "res\notif\ui_notif_ref.paa";
|
||||
color[] = {1,1,0,1};
|
||||
sound = "taskCanceled";
|
||||
color[] = { 1, 1, 0, 1 };
|
||||
sound = "taskCanceled";
|
||||
};
|
||||
class lib_intel_sar : lib_intel
|
||||
{
|
||||
description = $STR_NOTIFICATION_SAR_STARTED;
|
||||
class lib_intel_sar : lib_intel {
|
||||
description = $STR_NOTIFICATION_SAR_STARTED;
|
||||
};
|
||||
class lib_intel_sar_failed : lib_secondary_fob_destroyed
|
||||
{
|
||||
description = $STR_NOTIFICATION_SAR_FAILED;
|
||||
color[] = {1,0,0,1};
|
||||
sound = "taskFailed";
|
||||
class lib_intel_sar_failed : lib_secondary_fob_destroyed {
|
||||
description = $STR_NOTIFICATION_SAR_FAILED;
|
||||
color[] = { 1, 0, 0, 1 };
|
||||
sound = "taskFailed";
|
||||
};
|
||||
class lib_intel_sar_succeeded : lib_secondary_fob_destroyed
|
||||
{
|
||||
description = $STR_NOTIFICATION_SAR_SUCCESS;
|
||||
class lib_intel_sar_succeeded : lib_secondary_fob_destroyed {
|
||||
description = $STR_NOTIFICATION_SAR_SUCCESS;
|
||||
};
|
||||
};
|
||||
class lib_restart_60_s : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_RESTART_TITLE;
|
||||
description = $STR_NOTIFICATION_RESTART_SECOND;
|
||||
iconPicture = "res\notif\ui_notif_restart.paa";
|
||||
color[] = { 1, 1, 0, 1 };
|
||||
sound = "taskCanceled";
|
||||
};
|
||||
class lib_restart_5_min : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_RESTART_TITLE;
|
||||
description = $STR_NOTIFICATION_RESTART_FIVE;
|
||||
iconPicture = "res\notif\ui_notif_restart.paa";
|
||||
color[] = { 1, 1, 0, 1 };
|
||||
sound = "taskCanceled";
|
||||
};
|
||||
class lib_restart_15_min : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_RESTART_TITLE;
|
||||
description = $STR_NOTIFICATION_RESTART_FIFTEEN;
|
||||
iconPicture = "res\notif\ui_notif_restart.paa";
|
||||
color[] = { 1, 1, 0, 1 };
|
||||
sound = "taskCanceled";
|
||||
};
|
||||
class lib_restart_30_min : lib_default_notification {
|
||||
title = $STR_NOTIFICATION_RESTART_TITLE;
|
||||
description = $STR_NOTIFICATION_RESTART_THIRTY;
|
||||
iconPicture = "res\notif\ui_notif_restart.paa";
|
||||
color[] = { 1, 1, 0, 1 };
|
||||
sound = "taskCanceled";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
"ServerCommandPassword"
|
Loading…
Reference in New Issue