diff options
author | Florent Le Coz <louiz@louiz.org> | 2015-12-22 17:34:33 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2015-12-23 11:05:55 +0100 |
commit | 9167cdf1269c1956b72db1e8dfdbfd61cbf66bb9 (patch) | |
tree | 809d6b42ee6deab9ae3776566676c7abf5feeb87 /src | |
parent | 9714d02018904b0c207a3f4d7de0be1a6a22774b (diff) | |
download | biboumi-9167cdf1269c1956b72db1e8dfdbfd61cbf66bb9.tar.gz biboumi-9167cdf1269c1956b72db1e8dfdbfd61cbf66bb9.tar.bz2 biboumi-9167cdf1269c1956b72db1e8dfdbfd61cbf66bb9.tar.xz biboumi-9167cdf1269c1956b72db1e8dfdbfd61cbf66bb9.zip |
Notify systemd when the process is stopping
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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 <network/dns_handler.hpp> #endif +#ifdef SYSTEMD_FOUND +# include <systemd/sd-daemon.h> +#endif + // A flag set by the SIGINT signal handler. static volatile std::atomic<bool> 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(); |