Notify systemd when the process is stopping
This commit is contained in:
@@ -16,6 +16,10 @@
|
|||||||
# include <network/dns_handler.hpp>
|
# include <network/dns_handler.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SYSTEMD_FOUND
|
||||||
|
# include <systemd/sd-daemon.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// A flag set by the SIGINT signal handler.
|
// A flag set by the SIGINT signal handler.
|
||||||
static volatile std::atomic<bool> stop(false);
|
static volatile std::atomic<bool> stop(false);
|
||||||
// Flag set by the SIGUSR1/2 signal handler.
|
// Flag set by the SIGUSR1/2 signal handler.
|
||||||
@@ -136,6 +140,9 @@ int main(int ac, char** av)
|
|||||||
if (stop)
|
if (stop)
|
||||||
{
|
{
|
||||||
log_info("Signal received, exiting...");
|
log_info("Signal received, exiting...");
|
||||||
|
#ifdef SYSTEMD_FOUND
|
||||||
|
sd_notify(0, "STOPPING=1");
|
||||||
|
#endif
|
||||||
exiting = true;
|
exiting = true;
|
||||||
stop.store(false);
|
stop.store(false);
|
||||||
xmpp_component->shutdown();
|
xmpp_component->shutdown();
|
||||||
|
|||||||
Reference in New Issue
Block a user