|
|
|
@ -57,6 +57,21 @@ namespace Jellyfin.Server
|
|
|
|
|
errs => Task.FromResult(0)).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void Shutdown()
|
|
|
|
|
{
|
|
|
|
|
if (!_tokenSource.IsCancellationRequested)
|
|
|
|
|
{
|
|
|
|
|
_tokenSource.Cancel();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void Restart()
|
|
|
|
|
{
|
|
|
|
|
_restartOnShutdown = true;
|
|
|
|
|
|
|
|
|
|
Shutdown();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static async Task StartApp(StartupOptions options)
|
|
|
|
|
{
|
|
|
|
|
ServerApplicationPaths appPaths = CreateApplicationPaths(options);
|
|
|
|
@ -76,6 +91,7 @@ namespace Jellyfin.Server
|
|
|
|
|
{
|
|
|
|
|
return; // Already shutting down
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
_logger.LogInformation("Ctrl+C, shutting down");
|
|
|
|
|
Environment.ExitCode = 128 + 2;
|
|
|
|
@ -89,6 +105,7 @@ namespace Jellyfin.Server
|
|
|
|
|
{
|
|
|
|
|
return; // Already shutting down
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("Received a SIGTERM signal, shutting down");
|
|
|
|
|
Environment.ExitCode = 128 + 15;
|
|
|
|
|
Shutdown();
|
|
|
|
@ -146,7 +163,7 @@ namespace Jellyfin.Server
|
|
|
|
|
/// for everything else the XDG approach is followed:
|
|
|
|
|
/// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="options"></param>
|
|
|
|
|
/// <param name="options">StartupOptions</param>
|
|
|
|
|
/// <returns>ServerApplicationPaths</returns>
|
|
|
|
|
private static ServerApplicationPaths CreateApplicationPaths(StartupOptions options)
|
|
|
|
|
{
|
|
|
|
@ -308,6 +325,7 @@ namespace Jellyfin.Server
|
|
|
|
|
await rscstr.CopyToAsync(fstr).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var configuration = new ConfigurationBuilder()
|
|
|
|
|
.SetBasePath(appPaths.ConfigurationDirectoryPath)
|
|
|
|
|
.AddJsonFile("logging.json")
|
|
|
|
@ -335,7 +353,7 @@ namespace Jellyfin.Server
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IImageEncoder GetImageEncoder(
|
|
|
|
|
private static IImageEncoder GetImageEncoder(
|
|
|
|
|
IFileSystem fileSystem,
|
|
|
|
|
IApplicationPaths appPaths,
|
|
|
|
|
ILocalizationManager localizationManager)
|
|
|
|
@ -376,24 +394,10 @@ namespace Jellyfin.Server
|
|
|
|
|
{
|
|
|
|
|
return MediaBrowser.Model.System.OperatingSystem.BSD;
|
|
|
|
|
}
|
|
|
|
|
throw new Exception($"Can't resolve OS with description: '{osDescription}'");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void Shutdown()
|
|
|
|
|
{
|
|
|
|
|
if (!_tokenSource.IsCancellationRequested)
|
|
|
|
|
{
|
|
|
|
|
_tokenSource.Cancel();
|
|
|
|
|
throw new Exception($"Can't resolve OS with description: '{osDescription}'");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void Restart()
|
|
|
|
|
{
|
|
|
|
|
_restartOnShutdown = true;
|
|
|
|
|
|
|
|
|
|
Shutdown();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void StartNewInstance(StartupOptions options)
|
|
|
|
|