mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-11-01 00:12:30 +01:00
1ef6906dc1
Conflicts: NzbDrone.Common/IISProvider.cs NzbDrone.Core/CentralDispatch.cs
47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using NLog;
|
|
using NzbDrone.Common;
|
|
using NzbDrone.Core.Model.Notification;
|
|
|
|
namespace NzbDrone.Core.Jobs
|
|
{
|
|
public class AppRestartJob : IJob
|
|
{
|
|
private readonly EnvironmentProvider _environmentProvider;
|
|
private readonly ProcessProvider _processProvider;
|
|
private readonly ServiceProvider _serviceProvider;
|
|
private readonly IISProvider _iisProvider;
|
|
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
public AppRestartJob(EnvironmentProvider environmentProvider, ProcessProvider processProvider,
|
|
ServiceProvider serviceProvider, IISProvider iisProvider)
|
|
{
|
|
_environmentProvider = environmentProvider;
|
|
_processProvider = processProvider;
|
|
_serviceProvider = serviceProvider;
|
|
_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();
|
|
}
|
|
}
|
|
} |