From: Michael Friedrich Date: Wed, 16 Dec 2015 14:57:59 +0000 (+0100) Subject: Fix failed reload via systemd X-Git-Tag: v2.5.0~646 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8b6d3350b8a93f74bf1e730d1f2db576f0efb4cb;p=icinga2 Fix failed reload via systemd fixes #10226 --- diff --git a/lib/cli/daemoncommand.cpp b/lib/cli/daemoncommand.cpp index 4618bbd6b..8319d7e34 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