Shutdown gracefully when recieving a termination signal

pull/702/head
Bond_009 6 years ago
parent 78a5d999f4
commit 0abdfbb526

@ -6,6 +6,7 @@ using System.Net;
using System.Net.Security;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Loader;
using System.Threading.Tasks;
using Emby.Drawing;
using Emby.Drawing.Skia;
@ -55,6 +56,13 @@ namespace Jellyfin.Server
AppDomain.CurrentDomain.UnhandledException += (sender, e)
=> _logger.LogCritical((Exception)e.ExceptionObject, "Unhandled Exception");
// Register a SIGTERM handler
AppDomain.CurrentDomain.ProcessExit += (sender, e) =>
{
_logger.LogInformation("Received a SIGTERM signal, shutting down");
Shutdown();
};
_logger.LogInformation("Jellyfin version: {Version}", version);
EnvironmentInfo environmentInfo = new EnvironmentInfo(getOperatingSystem());

Loading…
Cancel
Save