2013-01-06 08:11:14 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using NLog;
|
|
|
|
|
using NzbDrone.Common;
|
2013-02-18 07:59:43 +00:00
|
|
|
|
using NzbDrone.Core.Jobs;
|
2013-01-06 08:11:14 +00:00
|
|
|
|
using NzbDrone.Core.Model.Notification;
|
|
|
|
|
|
2013-02-18 07:59:43 +00:00
|
|
|
|
namespace NzbDrone.Core.Lifecycle
|
2013-01-06 08:11:14 +00:00
|
|
|
|
{
|
|
|
|
|
public class AppRestartJob : IJob
|
|
|
|
|
{
|
2013-02-19 01:13:42 +00:00
|
|
|
|
private readonly HostController _hostController;
|
2013-01-06 08:11:14 +00:00
|
|
|
|
|
|
|
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
2013-02-19 01:13:42 +00:00
|
|
|
|
public AppRestartJob(HostController hostController)
|
2013-01-06 08:11:14 +00:00
|
|
|
|
{
|
2013-02-19 01:13:42 +00:00
|
|
|
|
_hostController = hostController;
|
2013-01-06 08:11:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
|
{
|
|
|
|
|
get { return "Restart NzbDrone"; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TimeSpan DefaultInterval
|
|
|
|
|
{
|
|
|
|
|
get { return TimeSpan.FromTicks(0); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void Start(ProgressNotification notification, dynamic options)
|
|
|
|
|
{
|
|
|
|
|
notification.CurrentMessage = "Restarting NzbDrone";
|
|
|
|
|
logger.Info("Restarting NzbDrone");
|
|
|
|
|
|
2013-02-19 01:13:42 +00:00
|
|
|
|
_hostController.StopServer();
|
2013-01-06 08:11:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|