1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-25 01:11:43 +00:00

Fixed: Updater occasionally killed Sonarr twice before allowing it to be restarted by upstart.

Fixed: Updater killed itself during update on debian jessie.
This commit is contained in:
Taloth Saldono 2015-07-08 20:54:47 +02:00
parent 103de770c3
commit 1eb6629088
3 changed files with 31 additions and 5 deletions

View file

@ -244,6 +244,12 @@ public void KillAll(string processName)
foreach (var processInfo in processes)
{
if (processInfo.Id == Process.GetCurrentProcess().Id)
{
_logger.Debug("Tried killing own process, skipping: {0} [{1}]", processInfo.Id, processInfo.ProcessName);
continue;
}
_logger.Debug("Killing process: {0} [{1}]", processInfo.Id, processInfo.ProcessName);
Kill(processInfo.Id);
}
@ -306,6 +312,18 @@ private List<Process> GetProcessesByName(string name)
_logger.Debug("Found {0} processes with the name: {1}", processes.Count, name);
try
{
foreach (var process in processes)
{
_logger.Debug(" - [{0}] {1}", process.Id, process.ProcessName);
}
}
catch
{
// Don't crash on gettings some log data.
}
return processes;
}

View file

@ -82,6 +82,9 @@ public void Start(string installationFolder, int processId)
try
{
_processProvider.FindProcessByName(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME);
_processProvider.FindProcessByName(ProcessProvider.NZB_DRONE_PROCESS_NAME);
if (OsInfo.IsWindows)
{
_terminateNzbDrone.Terminate(processId);

View file

@ -44,16 +44,21 @@ public void Terminate(int processId)
_logger.ErrorException("couldn't stop service", e);
}
}
_logger.Info("Killing all running processes");
_processProvider.KillAll(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME);
_processProvider.KillAll(ProcessProvider.NZB_DRONE_PROCESS_NAME);
}
else
{
_logger.Info("Killing all running processes");
_processProvider.KillAll(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME);
_processProvider.KillAll(ProcessProvider.NZB_DRONE_PROCESS_NAME);
_processProvider.Kill(processId);
}
_logger.Info("Killing all running processes");
_processProvider.KillAll(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME);
_processProvider.KillAll(ProcessProvider.NZB_DRONE_PROCESS_NAME);
}
}
}