You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using NLog;
|
|
|
|
|
using NzbDrone.Common;
|
|
|
|
|
using NzbDrone.Core.Jobs;
|
|
|
|
|
using NzbDrone.Core.Model.Notification;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Lifecycle
|
|
|
|
|
{
|
|
|
|
|
public class AppRestartJob : IJob
|
|
|
|
|
{
|
|
|
|
|
private readonly IISProvider _iisProvider;
|
|
|
|
|
|
|
|
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
|
|
|
|
public AppRestartJob(IISProvider iisProvider)
|
|
|
|
|
{
|
|
|
|
|
_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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|