From 2be7a0e0d5981e4ffb43c63445dbbcd508100210 Mon Sep 17 00:00:00 2001 From: Casini Lorenzo Date: Thu, 17 Aug 2017 14:22:42 +0200 Subject: [PATCH] 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 :) --- Missionframework/init.sqf | 1 + .../res/notif/ui_notif_restart.paa | Bin 0 -> 5625 bytes Missionframework/server_restart.sqf | 83 +++++++ Missionframework/stringtable.xml | 20 ++ .../ui/liberation_notifications.hpp | 224 +++++++++--------- userconfig/restart/myPass.hpp | 1 + 6 files changed, 220 insertions(+), 109 deletions(-) create mode 100644 Missionframework/res/notif/ui_notif_restart.paa create mode 100644 Missionframework/server_restart.sqf create mode 100644 userconfig/restart/myPass.hpp diff --git a/Missionframework/init.sqf b/Missionframework/init.sqf index 727fc861..1cd8f163 100644 --- a/Missionframework/init.sqf +++ b/Missionframework/init.sqf @@ -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 { diff --git a/Missionframework/res/notif/ui_notif_restart.paa b/Missionframework/res/notif/ui_notif_restart.paa new file mode 100644 index 0000000000000000000000000000000000000000..7e169c6c4b0729811e01c1269afe94dd4ccad90d GIT binary patch literal 5625 zcmd5=Z%kX)6~B-A;Zl`hBpy*i5M&{#hSFwJnWYSvAH=|-F55%%Ww2%%3Cf}>dG?nL zt(uT&78MC8cq?J~u%=LLQc*^elBTa8Dh(s5{2^M>ErB|9D>Rvw#f4yGG@v|lcg}t9 zIgXJ$QAf!E8XEimf9h)9lB81inq$=th)Ik}f zMc}=yUq#(mkPXbAgQx0t-U8ACEXZkFR6Bdezu@Bg0se8a|K+m%C(1ZYJ#w13bz~vu zf7xd6O9J4jd;Z&5>R z@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=>qEvg%uU`*zgbewuN>9uf!;uzqM6s|NdTw*f z@<89oNcQQx{jZeaI?38e_guT!5vn-M+x%w5mi@!@*PG$RqF=iuwD;$%; zZs>{4F-d~HuqS4W!MLupDj*+b2ABl7d{6-RbHmX248S^ceaUO1)U@}RYwg}0=CK!H zZhz)lfVa6E59a!$KTLkWgKO$&CC38=dhWqY1(TS;->SH$@!CDY{S9qPU&|-M9ihO- zw{YE~$ernUo26Sm(b^*I-oGK9BnnyXX$bB`>ss_QrQ_{Bz1)`2yhX@Qvc#RR|3EnJ zBNx(5icHX+uy%HI0BDG}Y|!d%lNNwq{Zsv`Bgo$eW83c2D+|}pgpsp)@0T4>Kb#vDod2z5^f9=ERj&Xh8lNuC3L3KU2|v?-vk zj&L*a*k(sxOU%4p%F{rGNMuKyaoyp24$XvhsUUhmx3e>TG!xdz(-WWn>!074<@{vd zzM5}FwCd3K@c~??iY$B#)83`me)lBO-^~pwPfsi#nXErPg?MCiv?hD*`?KS_R5#K! z`)Y(?vj6w|*EpcTYC24Q0KX=}uX8|yRWy6_J;tvE5+Of7IQ=4@wh#}xBl;+L6zy2fd+B=>bGJhH8Vy^{lU_Oe zLijI0Z%4zAk>C8ROn9{b*By!=9wUGM!+`z7E~IUutk|HUf 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; +}; diff --git a/Missionframework/stringtable.xml b/Missionframework/stringtable.xml index 8f9bd3de..f2a78f3b 100644 --- a/Missionframework/stringtable.xml +++ b/Missionframework/stringtable.xml @@ -4254,5 +4254,25 @@ completamente distrutto 完全损毁 + + SERVER RESTART NOTIFICATION + NOTIFICA RESTART SERVER + + + The server will restart in less than 60 seconds! + Il server si riavvierà tra meno di 60 secodni! + + + The server will restart in less than 5 minutes! + Il server si riavvierà tra meno di 5 minuti! + + + The server will restart in less than 15 minutes! + Il server si riavvierà tra meno di 15 minuti! + + + The server will restart in less than 30 minutes! + Il server si riavvierà tra meno di 30 minuti! + diff --git a/Missionframework/ui/liberation_notifications.hpp b/Missionframework/ui/liberation_notifications.hpp index b6154154..8ca255e6 100644 --- a/Missionframework/ui/liberation_notifications.hpp +++ b/Missionframework/ui/liberation_notifications.hpp @@ -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; }; -}; \ No newline at end of file + 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"; + }; +}; diff --git a/userconfig/restart/myPass.hpp b/userconfig/restart/myPass.hpp new file mode 100644 index 00000000..2f382d47 --- /dev/null +++ b/userconfig/restart/myPass.hpp @@ -0,0 +1 @@ +"ServerCommandPassword"