From 9167cdf1269c1956b72db1e8dfdbfd61cbf66bb9 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Tue, 22 Dec 2015 17:34:33 +0100 Subject: Notify systemd when the process is stopping --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index a160df9..226b400 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,6 +16,10 @@ # include #endif +#ifdef SYSTEMD_FOUND +# include +#endif + // A flag set by the SIGINT signal handler. static volatile std::atomic stop(false); // Flag set by the SIGUSR1/2 signal handler. @@ -136,6 +140,9 @@ int main(int ac, char** av) if (stop) { log_info("Signal received, exiting..."); +#ifdef SYSTEMD_FOUND + sd_notify(0, "STOPPING=1"); +#endif exiting = true; stop.store(false); xmpp_component->shutdown(); -- cgit v1.2.3