Răsfoiți Sursa

corosync-qnetd: send startup notification to systemd

Signed-off-by: Ferenc Wágner <wferi@debian.org>
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Ferenc Wágner 9 ani în urmă
părinte
comite
bccfbae62b
3 a modificat fișierele cu 12 adăugiri și 3 ștergeri
  1. 1 1
      init/corosync-qnetd.service.in
  2. 2 2
      qdevices/Makefile.am
  3. 9 0
      qdevices/corosync-qnetd.c

+ 1 - 1
init/corosync-qnetd.service.in

@@ -8,7 +8,7 @@ After=network-online.target
 [Service]
 EnvironmentFile=-@INITCONFIGDIR@/corosync-qnetd
 ExecStart=@BINDIR@/corosync-qnetd -f $COROSYNC_QNETD_OPTIONS
-Type=simple
+Type=notify
 Restart=on-abnormal
 # Uncomment and set user who should be used for executing qnetd
 #User=coroqnetd

+ 2 - 2
qdevices/Makefile.am

@@ -75,8 +75,8 @@ corosync_qnetd_SOURCES	= corosync-qnetd.c \
 corosync_qnetd_tool_SOURCES = corosync-qnetd-tool.c unix-socket.c unix-socket.h dynar.c dynar.h \
                               dynar-str.c dynar-str.h utils.c utils.h
 
-corosync_qnetd_CFLAGS		= $(nss_CFLAGS)
-corosync_qnetd_LDADD		= $(nss_LIBS)
+corosync_qnetd_CFLAGS		= $(nss_CFLAGS) $(libsystemd_CFLAGS)
+corosync_qnetd_LDADD		= $(nss_LIBS)   $(libsystemd_LIBS)
 
 corosync-qnetd-certutil: corosync-qnetd-certutil.sh
 	sed -e 's#@''DATADIR@#${datadir}#g' \

+ 9 - 0
qdevices/corosync-qnetd.c

@@ -56,6 +56,10 @@
 #include "utils.h"
 #include "msg.h"
 
+#ifdef HAVE_LIBSYSTEMD
+#include <systemd/sd-daemon.h>
+#endif
+
 /*
  * This is global variable used for comunication with main loop and signal (calls close)
  */
@@ -613,6 +617,11 @@ main(int argc, char * const argv[])
 	}
 
 	qnetd_log(LOG_DEBUG, "QNetd ready to provide service");
+
+#ifdef HAVE_LIBSYSTEMD
+	sd_notify(0, "READY=1");
+#endif
+
 	/*
 	 * MAIN LOOP
 	 */