mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-22 05:30:46 +02:00
commit
f70e89130b
|
@ -12,8 +12,6 @@ using MediaBrowser.IsoMounter;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using MediaBrowser.Model.Updates;
|
|
||||||
using MediaBrowser.Server.Startup.Common;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Mono
|
namespace MediaBrowser.Server.Mono
|
||||||
{
|
{
|
||||||
|
@ -44,7 +42,7 @@ namespace MediaBrowser.Server.Mono
|
||||||
|
|
||||||
protected override void RestartInternal()
|
protected override void RestartInternal()
|
||||||
{
|
{
|
||||||
MainClass.Restart(StartupOptions);
|
MainClass.Restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override List<Assembly> GetAssembliesWithPartsInternal()
|
protected override List<Assembly> GetAssembliesWithPartsInternal()
|
||||||
|
|
|
@ -33,6 +33,9 @@ namespace MediaBrowser.Server.Mono
|
||||||
private static ILogger _logger;
|
private static ILogger _logger;
|
||||||
private static IFileSystem FileSystem;
|
private static IFileSystem FileSystem;
|
||||||
|
|
||||||
|
private static readonly TaskCompletionSource<bool> ApplicationTaskCompletionSource = new TaskCompletionSource<bool>();
|
||||||
|
private static bool _restartOnShutdown;
|
||||||
|
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var applicationPath = Assembly.GetEntryAssembly().Location;
|
var applicationPath = Assembly.GetEntryAssembly().Location;
|
||||||
|
@ -63,9 +66,13 @@ namespace MediaBrowser.Server.Mono
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
logger.Info("Shutting down");
|
_logger.Info("Disposing app host");
|
||||||
|
|
||||||
_appHost.Dispose();
|
_appHost.Dispose();
|
||||||
|
|
||||||
|
if (_restartOnShutdown)
|
||||||
|
{
|
||||||
|
StartNewInstance(options);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,8 +93,6 @@ namespace MediaBrowser.Server.Mono
|
||||||
return new ServerApplicationPaths(programDataPath, appFolderPath, Path.GetDirectoryName(applicationPath));
|
return new ServerApplicationPaths(programDataPath, appFolderPath, Path.GetDirectoryName(applicationPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly TaskCompletionSource<bool> ApplicationTaskCompletionSource = new TaskCompletionSource<bool>();
|
|
||||||
|
|
||||||
private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, StartupOptions options)
|
private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, StartupOptions options)
|
||||||
{
|
{
|
||||||
// Allow all https requests
|
// Allow all https requests
|
||||||
|
@ -243,11 +248,15 @@ namespace MediaBrowser.Server.Mono
|
||||||
ApplicationTaskCompletionSource.SetResult(true);
|
ApplicationTaskCompletionSource.SetResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Restart(StartupOptions startupOptions)
|
public static void Restart()
|
||||||
{
|
{
|
||||||
_logger.Info("Disposing app host");
|
_restartOnShutdown = true;
|
||||||
_appHost.Dispose();
|
|
||||||
|
|
||||||
|
Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void StartNewInstance(StartupOptions startupOptions)
|
||||||
|
{
|
||||||
_logger.Info("Starting new instance");
|
_logger.Info("Starting new instance");
|
||||||
|
|
||||||
string module = startupOptions.GetOption("-restartpath");
|
string module = startupOptions.GetOption("-restartpath");
|
||||||
|
@ -260,9 +269,9 @@ namespace MediaBrowser.Server.Mono
|
||||||
if (!startupOptions.ContainsOption("-restartargs"))
|
if (!startupOptions.ContainsOption("-restartargs"))
|
||||||
{
|
{
|
||||||
var args = Environment.GetCommandLineArgs()
|
var args = Environment.GetCommandLineArgs()
|
||||||
.Skip(1)
|
.Skip(1)
|
||||||
.Select(NormalizeCommandLineArgument)
|
.Select(NormalizeCommandLineArgument)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
commandLineArgsString = string.Join(" ", args);
|
commandLineArgsString = string.Join(" ", args);
|
||||||
}
|
}
|
||||||
|
@ -271,9 +280,6 @@ namespace MediaBrowser.Server.Mono
|
||||||
_logger.Info("Arguments: {0}", commandLineArgsString);
|
_logger.Info("Arguments: {0}", commandLineArgsString);
|
||||||
|
|
||||||
Process.Start(module, commandLineArgsString);
|
Process.Start(module, commandLineArgsString);
|
||||||
|
|
||||||
_logger.Info("Calling Environment.Exit");
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string NormalizeCommandLineArgument(string arg)
|
private static string NormalizeCommandLineArgument(string arg)
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("3.2.29.2")]
|
[assembly: AssemblyVersion("3.2.30.1")]
|
||||||
|
|
Loading…
Reference in a new issue