diff options
Diffstat (limited to 'daemon/daemon.c')
| -rw-r--r-- | daemon/daemon.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/daemon/daemon.c b/daemon/daemon.c index 88c695be31637..4cae4380065aa 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -88,6 +88,10 @@ #include "sldns/keyraw.h" #include <signal.h> +#ifdef HAVE_SYSTEMD +#include <systemd/sd-daemon.h> +#endif + /** How many quit requests happened. */ static int sig_record_quit = 0; /** How many reload requests happened. */ @@ -175,8 +179,15 @@ static void signal_handling_playback(struct worker* wrk) { #ifdef SIGHUP - if(sig_record_reload) + if(sig_record_reload) { +# ifdef HAVE_SYSTEMD + sd_notify(0, "RELOADING=1"); +# endif worker_sighandler(SIGHUP, wrk); +# ifdef HAVE_SYSTEMD + sd_notify(0, "READY=1"); +# endif + } #endif if(sig_record_quit) worker_sighandler(SIGTERM, wrk); @@ -595,8 +606,14 @@ daemon_fork(struct daemon* daemon) signal_handling_playback(daemon->workers[0]); /* Start resolver service on main thread. */ +#ifdef HAVE_SYSTEMD + sd_notify(0, "READY=1"); +#endif log_info("start of service (%s).", PACKAGE_STRING); worker_work(daemon->workers[0]); +#ifdef HAVE_SYSTEMD + sd_notify(0, "STOPPING=1"); +#endif log_info("service stopped (%s).", PACKAGE_STRING); /* we exited! a signal happened! Stop other threads */ |
