fi
done
+AX_AVAILABLE_SYSTEMD
+AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
+
LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
CFLAGS="$PIE_CFLAGS $CFLAGS"
[Unit]
Description=PowerDNS Authoritative Server
Documentation=man:pdns_server(1) man:pdns_control(1)
+Documentation=https://doc.powerdns.com
Wants=network-online.target
After=network-online.target mysqld.service postgresql.service slapd.service
[Service]
-Type=forking
-ExecStart=/usr/sbin/pdns_server --daemon
+Type=notify
+ExecStart=/usr/sbin/pdns_server --guardian=no --daemon=no --disable-syslog --write-pid=no
Restart=on-failure
StartLimitInterval=0
PrivateTmp=true
-I$(top_srcdir)/ext/json11 \
$(YAHTTP_CFLAGS) \
$(LIBEDIT_CFLAGS) \
- $(OPENSSL_INCLUDES)
+ $(OPENSSL_INCLUDES) \
+ $(SYSTEMD_CFLAGS)
AM_CXXFLAGS = \
-DSYSCONFDIR=\"$(sysconfdir)\" \
$(LIBDL) \
$(YAHTTP_LIBS) \
$(JSON11_LIBS) \
- $(OPENSSL_LIBS)
+ $(OPENSSL_LIBS) \
+ $(SYSTEMD_LIBS)
if BOTAN110
pdns_server_SOURCES += botan110signers.cc
#include <sys/resource.h>
#include "dynhandler.hh"
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#endif
bool g_anyToTcp;
typedef Distributor<DNSPacket,DNSPacket,PacketHandler> DNSDistributor;
pthread_create(&qtid,0,carbonDumpThread, 0); // runs even w/o carbon, might change @ runtime
+#ifdef HAVE_SYSTEMD
+ /* If we are here, notify systemd that we are ay-ok! This might have some
+ * timing issues with the backend-threads. e.g. if the initial MySQL connection
+ * is slow and times out (leading to process termination through the backend)
+ * We probably have told systemd already that we have started correctly.
+ */
+ sd_notify(0, "READY=1");
+#endif
+
for(;;) {
sleep(1800);
try {