Commit bdb46f5e authored by Jan Včelák's avatar Jan Včelák 🚀

knotd: use sd_notify() after starting the server

close #213
parent c60ac052
......@@ -279,6 +279,9 @@ libknotd_la_LIBADD = libknots.la libknot.la
# sbin programs
knotd_LDADD = libknot.la libknotd.la
knotd_CPPFLAGS = ${systemd_daemon_CFLAGS}
knotd_LDFLAGS = ${systemd_daemon_LIBS}
knotc_LDADD = libknot.la libknotd.la
# bin programs
......
......@@ -26,6 +26,10 @@
#include <cap-ng.h>
#endif /* HAVE_CAP_NG_H */
#ifdef ENABLE_SYSTEMD_NOTIFY
#include <systemd/sd-daemon.h>
#endif
#include "libknot/common.h"
#include "libknot/dnssec/crypto.h"
#include "knot/knot.h"
......@@ -42,6 +46,14 @@ static volatile short sig_req_stop = 0;
static volatile short sig_req_reload = 0;
static volatile short sig_stopping = 0;
/** \brief Signal started state to the init system. */
static void init_signal_started(void)
{
#ifdef ENABLE_SYSTEMD_NOTIFY
sd_notify(0, "READY=1");
#endif
}
// atexit() handler for server code
static void knot_crypto_deinit(void)
{
......@@ -347,6 +359,7 @@ int main(int argc, char **argv)
} else {
log_server_info("Server started in foreground, PID = %ld\n",
pid);
init_signal_started();
}
/* Start the event loop. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment