From 99efc7be2cf361031e607dd13c1b463118e9b5d1 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Wed, 16 Dec 2015 15:57:59 +0100 Subject: [PATCH] Fix failed reload via systemd fixes #10226 --- lib/cli/daemoncommand.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/cli/daemoncommand.cpp b/lib/cli/daemoncommand.cpp index 7f225820f..f650af3a4 100644 --- a/lib/cli/daemoncommand.cpp +++ b/lib/cli/daemoncommand.cpp @@ -35,6 +35,7 @@ #include #include #include +#include using namespace icinga; namespace po = boost::program_options; @@ -152,9 +153,15 @@ static void TerminateAndWaitForEnd(pid_t target) ret = kill(target, 0); } - // timeout and the process still seems to live: kill it - if (ret == 0 || errno != ESRCH) + // timeout and the process still seems to live: update pid and kill it + if (ret == 0 || errno != ESRCH) { + String pidFile = Application::GetPidPath(); + std::ofstream fp(pidFile.CStr()); + fp << Utility::GetPid(); + fp.close(); + kill(target, SIGKILL); + } #else // TODO: implement this for Win32 -- 2.40.0