ソースを参照

corosync-qdevice: 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 年 前
コミット
800f762ee9
3 ファイル変更14 行追加5 行削除
  1. 4 3
      init/corosync-qdevice.service.in
  2. 3 2
      qdevices/Makefile.am
  3. 7 0
      qdevices/corosync-qdevice.c

+ 4 - 3
init/corosync-qdevice.service.in

@@ -6,9 +6,10 @@ Wants=corosync.service
 After=corosync.service
 
 [Service]
-ExecStart=@INITWRAPPERSDIR@/corosync-qdevice start
-ExecStop=@INITWRAPPERSDIR@/corosync-qdevice stop
-Type=forking
+EnvironmentFile=-@INITCONFIGDIR@/corosync-qdevice
+ExecStart=@SBINDIR@/corosync-qdevice -f $COROSYNC_QDEVICE_OPTIONS
+Type=notify
+Restart=on-abnormal
 RuntimeDirectory=corosync-qdevice
 RuntimeDirectoryMode=0770
 

+ 3 - 2
qdevices/Makefile.am

@@ -145,8 +145,9 @@ corosync_qdevice_SOURCES = corosync-qdevice.c \
 corosync_qdevice_tool_SOURCES = corosync-qdevice-tool.c unix-socket.c unix-socket.h dynar.c dynar.h \
                                 dynar-str.c dynar-str.h utils.c utils.h
 
-corosync_qdevice_CFLAGS	= $(nss_CFLAGS)
-corosync_qdevice_LDADD	= $(nss_LIBS) $(LIBQB_LIBS) $(top_builddir)/lib/libcmap.la \
+corosync_qdevice_CFLAGS	= $(nss_CFLAGS) $(libsystemd_CFLAGS)
+corosync_qdevice_LDADD	= $(nss_LIBS)   $(libsystemd_LIBS) $(LIBQB_LIBS) \
+                          $(top_builddir)/lib/libcmap.la \
                           $(top_builddir)/lib/libvotequorum.la
 
 corosync-qdevice-net-certutil: corosync-qdevice-net-certutil.sh

+ 7 - 0
qdevices/corosync-qdevice.c

@@ -48,6 +48,10 @@
 #include "qdevice-votequorum.h"
 #include "utils.h"
 
+#ifdef HAVE_LIBSYSTEMD
+#include <systemd/sd-daemon.h>
+#endif
+
 struct qdevice_instance *global_instance;
 
 static void
@@ -258,6 +262,9 @@ main(int argc, char * const argv[])
 	signal_handlers_register();
 
 	qdevice_log(LOG_DEBUG, "Running qdevice model");
+#ifdef HAVE_LIBSYSTEMD
+	sd_notify (0, "READY=1");
+#endif
 	if (qdevice_model_run(&instance) != 0) {
 		return (1);
 	}