This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: master - cmannotifyd: add options to init script to handledaemon startup


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=e6348b362ac082f0965744bc11134ba22f57b8f1
Commit:        e6348b362ac082f0965744bc11134ba22f57b8f1
Parent:        3cc0a7367fd5048e5e1deb3d0bd776896c22d170
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Tue Feb 24 11:06:08 2009 +0100
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Tue Feb 24 11:13:39 2009 +0100

cmannotifyd: add options to init script to handle daemon startup

Don't start the daemon if it's not necessary. Also allow manual user
override.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 cman/init.d/Makefile |    1 +
 cman/init.d/cman.in  |   26 +++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/cman/init.d/Makefile b/cman/init.d/Makefile
index 8683c81..554aa75 100644
--- a/cman/init.d/Makefile
+++ b/cman/init.d/Makefile
@@ -14,6 +14,7 @@ $(TARGET1): $(S)/$(TARGET1).in
 	cat $(S)/$(TARGET1).in | sed \
 		-e 's#@SBINDIR@#${sbindir}#g' \
 		-e 's#@INITDDIR@#${initddir}#g' \
+		-e 's#@NOTIFYDDIR@#${notifyddir}#g' \
 	> $(TARGET1)
 
 $(TARGET2): $(S)/$(TARGET2).in
diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index 026eaed..9114adc 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -84,6 +84,14 @@ fi
 #     The default is 60 seconds
 [ -z "$CMAN_SHUTDOWN_TIMEOUT" ] && CMAN_SHUTDOWN_TIMEOUT=60
 
+# CMAN_NOTIFYD_START - control the startup behaviour for cmannotifyd
+# the variable can take 3 values:
+# yes                   | will always start cmannotifyd
+# no                    | will never start cmannotifyd
+# conditional (default) | will start cmannotifyd only if scriptlets
+#                         are found in @NOTIFYDDIR@
+[ -z "$CMAN_NOTIFYD_START" ] && CMAN_NOTIFYD_START=conditional
+
 # FENCED_START_TIMEOUT -- amount of time to wait for starting fenced
 #     before giving up.  If FENCED_START_TIMEOUT is positive, then we will
 #     wait FENCED_START_TIMEOUT seconds before giving up and failing when
@@ -241,7 +249,23 @@ start_daemons()
     fi
     status cmannotifyd > /dev/null 2>&1
     if [ $? -ne 0 ]; then
-	errmsg=$( @SBINDIR@/cmannotifyd 2>&1 ) || return 1
+	case "$CMAN_NOTIFYD_START" in
+	    yes)
+		errmsg=$(@SBINDIR@/cmannotifyd 2>&1 ) || return 1
+	    ;;
+	    no)
+		# nothing to do
+	    ;;
+	    conditional)
+		if [ -n "$(ls -1 @NOTIFYDDIR@)" ]; then
+		    errmsg=$(@SBINDIR@/cmannotifyd 2>&1 ) || return 1
+		fi
+	    ;;
+	    *)
+		errmsg="unknown CMAN_NOTIFYD_START option"
+		exit 1
+	    ;;
+	esac
     fi
     return 0
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]