2013-01-06 11:11:14 +03:00
|
|
|
using System;
|
|
|
|
using System.Linq;
|
|
|
|
using NLog;
|
|
|
|
using NzbDrone.Common;
|
2013-02-18 10:59:43 +03:00
|
|
|
using NzbDrone.Core.Jobs;
|
2013-01-06 11:11:14 +03:00
|
|
|
using NzbDrone.Core.Model.Notification;
|
|
|
|
|
2013-02-18 10:59:43 +03:00
|
|
|
namespace NzbDrone.Core.Lifecycle
|
2013-01-06 11:11:14 +03:00
|
|
|
{
|
|
|
|
public class AppRestartJob : IJob
|
|
|
|
{
|
2013-02-19 04:13:42 +03:00
|
|
|
private readonly HostController _hostController;
|
2013-01-06 11:11:14 +03:00
|
|
|
|
|
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
2013-02-19 04:13:42 +03:00
|
|
|
public AppRestartJob(HostController hostController)
|
2013-01-06 11:11:14 +03:00
|
|
|
{
|
2013-02-19 04:13:42 +03:00
|
|
|
_hostController = hostController;
|
2013-01-06 11:11:14 +03: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 04:13:42 +03:00
|
|
|
_hostController.StopServer();
|
2013-01-06 11:11:14 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|