فهرست منبع

Send corosync-notifyd startup notification to systemd

Signed-off-by: Ferenc Wágner <wferi@debian.org>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Ferenc Wágner 8 سال پیش
والد
کامیت
188f9bdb1e
3فایلهای تغییر یافته به همراه11 افزوده شده و 2 حذف شده
  1. 1 1
      init/corosync-notifyd.service.in
  2. 2 1
      tools/Makefile.am
  3. 8 0
      tools/corosync-notifyd.c

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

@@ -7,7 +7,7 @@ After=corosync.service
 [Service]
 EnvironmentFile=-@INITCONFIGDIR@/corosync-notifyd
 ExecStart=@SBINDIR@/corosync-notifyd -f $OPTIONS
-Type=simple
+Type=notify
 Restart=on-failure
 
 [Install]

+ 2 - 1
tools/Makefile.am

@@ -67,8 +67,9 @@ corosync_quorumtool_LDADD = $(LIBQB_LIBS) \
 			    $(top_builddir)/lib/libquorum.la \
 			    $(top_builddir)/lib/libvotequorum.la
 
-corosync_notifyd_CFLAGS   = $(DBUS_CFLAGS)
+corosync_notifyd_CFLAGS   = $(DBUS_CFLAGS) $(libsystemd_CFLAGS)
 corosync_notifyd_LDADD    = $(LIBQB_LIBS) $(DBUS_LIBS) $(SNMP_LIBS) \
+			    $(libsystemd_LIBS) \
 			    $(top_builddir)/lib/libcmap.la \
 			    $(top_builddir)/lib/libcfg.la \
 			    $(top_builddir)/lib/libquorum.la

+ 8 - 0
tools/corosync-notifyd.c

@@ -60,6 +60,10 @@
 #include <corosync/quorum.h>
 #include <corosync/cmap.h>
 
+#ifdef HAVE_LIBSYSTEMD
+#include <systemd/sd-daemon.h>
+#endif
+
 /*
  * generic declarations
  */
@@ -1318,6 +1322,10 @@ main(int argc, char *argv[])
 			   sig_exit_handler,
 			   NULL);
 
+#ifdef HAVE_LIBSYSTEMD
+	sd_notify (0, "READY=1");
+#endif
+
 	qb_loop_run(main_loop);
 
 #ifdef HAVE_DBUS