private static void CheckRoutine(object sender, EventArgs e) { //Run Server check foreach (var Server in Servers) { //Log that server is currently updating game files if (Server.CurrentlyUpdating) { //Console.WriteLine(DateTime.Now + ": " + Server.Name + " is currently updating."); Methods.Log(Server, DateTime.Now + ": " + Server.Name + " is currently updating."); } //If any event was triggered, or if the server is updating, do not run check routines. if (!Server.stopServerTimer && !Server.CurrentlyUpdating) { //Console.WriteLine(DateTime.Now + ": Entered " + Server.Name + "'s check method. RunningTimer = " + nRunningEventsTriggered); Methods.Log(Server, DateTime.Now + ": Entered " + Server.Name + "'s check method. RunningTimer = " + nRunningEventsTriggered); bool processOpen = GlobalVariables.IsProcessOpen(Server); bool ServerIsResponding = RCONCommands.IsServerResponding(Server); //Console.WriteLine("Server Response: " + ServerIsResponding); Methods.Log(Server, "Server Response: " + ServerIsResponding); Server.ModUpdateNeeded = GlobalVariables.NeedsModUpdate(Server); //Console.WriteLine("Mods are up to date: " + !Server.ModUpdateNeeded); Methods.Log(Server, DateTime.Now + ": Mods are up to date: " + !Server.ModUpdateNeeded); Server.GameUpdateNeeded = GlobalVariables.NeedsArkUpdate(Server); //Console.WriteLine("Game is up to date: " + !Server.GameUpdateNeeded); Methods.Log(Server, DateTime.Now + ": Game are up to date: " + !Server.GameUpdateNeeded); if (Server.ModUpdateNeeded && processOpen) { //Restart and Update the server if update is needed. RestartProcedures.BroadCastArkUpdateRestartTimer(Server, "Mod Update: " + Server.theModNeedingUpdate); Server.ModUpdateNeeded = false; Server.stopServerTimer = true; } //If process is open and game needs to be updated, trigger restart counter if (Server.GameUpdateNeeded && processOpen) { RestartProcedures.BroadCastArkUpdateRestartTimer(Server, "Ark Update"); Server.GameUpdateNeeded = false; Server.stopServerTimer = true; } if (processOpen && !ServerIsResponding) { if (Server.nEventsProcessOpenNotResponding == 10) { RestartUnresponsive(Server); } if (!Server.CurrentlyUpdating) { Server.nEventsProcessOpenNotResponding++; } } if (nRunningEventsTriggered % 60 == 0) { string message = "25 TC Reward points for recruiting players. See Dicord for more information."; Console.WriteLine(DateTime.Now + ": Message sent to " + Server.Name + " - " + message); RCONCommands.GlobalNotification(Server, message); } //Run Game Version Update every 20 minutes if (nRunningEventsTriggered % 20 == 0) { Processes.ModVersionUpdate(Server); } //If process is not running, AND timer is not stopped and server is not update then trigger the start routine. if (!processOpen) { Methods.StartServerProcedure(Server); } } //If the server has ran for 12 hours, trigger the routine maintenance restart. //if (nRagEventsTriggered % GlobalVariables.timeIntervalMaintenanceRestart == 0 && RagProcessOpen) //{ // ServerRestartForModORRoutineMaintenance(Ragnarok, "Routine Maintenance"); // RagnarokTimerTriggerStopped = true; //} //Backup the server every 2 hours. if (nRunningEventsTriggered % 30 == 0) { Methods.BackupServerFiles(Server); } } nRunningEventsTriggered++; }