Merge pull request #21 from Bletch1971/ServerMonitorChanges

Server monitor changes
This commit is contained in:
Brett Hewitson 2022-05-18 23:54:00 +10:00 committed by GitHub
commit bdd36bf235
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 1825 additions and 329 deletions

View file

@ -102,6 +102,7 @@ namespace ServerManagerTool.Lib
public bool DeleteOldBackupFiles = Config.Default.AutoBackup_DeleteOldFiles;
public int ExitCode = EXITCODE_NORMALEXIT;
public bool OutputLogs = false;
public bool PerformWorldSave = Config.Default.ServerShutdown_EnableWorldSave;
public bool SendAlerts = false;
public bool SendEmails = false;
public string ShutdownReason = null;
@ -258,11 +259,14 @@ namespace ServerManagerTool.Lib
ServerStatusChangeCallback?.Invoke(ServerStatus.Stopped);
// make a backup of the current profile and config files.
CreateProfileBackupArchiveFile(_profile);
if (ServerProcess != ServerProcessType.Stop)
{
// make a backup of the current profile and config files.
CreateProfileBackupArchiveFile(_profile);
if (ExitCode != EXITCODE_NORMALEXIT)
return;
if (ExitCode != EXITCODE_NORMALEXIT)
return;
}
if (BackupWorldFile)
{
@ -285,10 +289,10 @@ namespace ServerManagerTool.Lib
{
ServerStatusChangeCallback?.Invoke(ServerStatus.Stopped);
}
}
if (ExitCode != EXITCODE_NORMALEXIT)
return;
if (ExitCode != EXITCODE_NORMALEXIT)
return;
}
// check if this is a shutdown only, or a shutdown and restart.
if (restartServer)
@ -579,7 +583,7 @@ namespace ServerManagerTool.Lib
// BH - commented out until funcom provide a way to send a save command
// check if we need to perform a world save
//if (serverAccessible && Config.Default.ServerShutdown_EnableWorldSave)
//if (serverAccessible && PerformWorldSave)
//{
// try
// {
@ -716,6 +720,7 @@ namespace ServerManagerTool.Lib
if (process.HasExited)
{
process.Close();
if (Config.Default.EmailNotify_ShutdownRestart)
SendEmail($"{_profile.ProfileName} server shutdown", $"The server has been shutdown to perform the {ServerProcess} process.", false);
}