/// <summary> /// Runs the exit logic /// </summary> private static void Exit() { LunaLog.Normal("Exiting... Please give LMP 5 seconds to close the files correctly"); ServerContext.Shutdown(); QuitEvent.Set(); Thread.Sleep(5000); }
//Gracefully shut down private static async void CatchExit(object sender, ConsoleCancelEventArgs args) { ServerContext.Shutdown(); QuitEvent.Set(); args.Cancel = true; await Task.Delay(5000); }
/// <summary> /// Runs the exit logic /// </summary> private static void Exit() { LunaLog.Normal("Exiting... Please wait until all threads are finished"); ServerContext.Shutdown("Server is shutting down"); CancellationTokenSrc.Cancel(); Task.WaitAll(TaskContainer.ToArray()); QuitEvent.Set(); }
/// <summary> /// Runs the restart logic /// </summary> public static void Restart() { //Perform Backups BackupSystem.PerformBackups(); LunaLog.Normal("Restarting... Please wait until all threads are finished"); ServerContext.Shutdown("Server is restarting"); CancellationTokenSrc.Cancel(); Task.WaitAll(TaskContainer.ToArray()); QuitEvent.Set(); //Start new server string serverExePath = Common.PlatformIsWindows() ? Path.Combine(startdir, "Server.exe") : Path.Combine(startdir, "Server"); Process.Start(new ProcessStartInfo { FileName = serverExePath }); }
/// <summary> /// Runs the restart logic /// </summary> public static void Restart() { //Perform Backups BackupSystem.PerformBackups(CancellationTokenSrc.Token); LunaLog.Normal("Restarting... Please wait until all threads are finished"); ServerContext.Shutdown("Server is restarting"); CancellationTokenSrc.Cancel(); Task.WaitAll(TaskContainer.ToArray()); QuitEvent.Set(); //Start new server var serverExePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Server.exe"; var newProcLmpServer = new ProcessStartInfo { FileName = serverExePath }; Process.Start(newProcLmpServer); }