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
|
|
|
|
|
{
|
|
|
|
|
private readonly IISProvider _iisProvider;
|
|
|
|
|
|
|
|
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
2013-02-17 16:23:53 +00:00
|
|
|
|
public AppRestartJob(IISProvider iisProvider)
|
2013-01-06 08:11:14 +00:00
|
|
|
|
{
|
|
|
|
|
_iisProvider = iisProvider;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
|
|
_iisProvider.StopServer();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|