public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: STABLE3 - cman init: allow users to set the init script loglevel
@ 2009-03-27 19:16 Fabio M. Di Nitto
  0 siblings, 0 replies; only message in thread
From: Fabio M. Di Nitto @ 2009-03-27 19:16 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=fec01964ef122758a5ddd7fd291ed203cb556ffc
Commit:        fec01964ef122758a5ddd7fd291ed203cb556ffc
Parent:        a63444d50d2ea6daa279e5f83f0f482aab5acea5
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Thu Mar 26 13:40:01 2009 +0100
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Fri Mar 27 20:05:46 2009 +0100

cman init: allow users to set the init script loglevel

this is useful for people that don't want to see any info
on the cluster startup to people that want to know why
something is not happening

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

diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index 9d27276..3a23a0a 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -138,12 +138,20 @@ fi
 # openaisparser   - use internal openais config file parser.
 [ -n "$CONFIG_LOADER" ] && cman_join_opts+=" -C $CONFIG_LOADER"
 
+# INITLOGLEVEL -- select how verbose the init script should be
+# possible values:
+# quiet           - only one line notification for start/stop operations
+# terse (default) - show only required activity
+# full            - show everything
+[ -z "$INITLOGLEVEL" ] && INITLOGLEVEL=terse
 
 ### generic wrapper functions
 
 ok() {
-	success
-	echo
+	if [ "$INITLOGLEVEL" != "quiet" ]; then
+		success
+		echo
+	fi
 }
 
 nok() {
@@ -167,10 +175,15 @@ runwrap()
 	message="$@"
 
 	if ! $conditional; then
+		if [ "$INITLOGLEVEL" = "full" ]; then
+			echo "   $message... action not required"
+		fi
 		return 0
 	fi
 
-	echo -n "   $message... "
+	if [ "$INITLOGLEVEL" != "quiet" ]; then
+		echo -n "   $message... "
+	fi
 	if $function; then
 		ok
 	else
@@ -544,7 +557,11 @@ stop_fence_xvmd()
 
 start()
 {
-	echo "Starting cluster: "
+	if [ "$INITLOGLEVEL" = "quiet" ]; then
+		echoarg="-n"
+	fi
+
+	echo $echoarg "Starting cluster: "
 
 	runwrap start_global \
 		none \
@@ -609,7 +626,11 @@ start()
 
 stop()
 {
-	echo "Stopping cluster: "
+	if [ "$INITLOGLEVEL" = "quiet" ]; then
+		echoarg="-n"
+	fi
+
+	echo $echoarg "Stopping cluster: "
 
 	runwrap stop_fence_xvmd \
 		fence_xvmd_enabled \
@@ -692,10 +713,18 @@ rtrn=0
 case "$1" in
 start)
 	start && touch $LOCK_FILE
+	if [ "$INITLOGLEVEL" = "quiet" ]; then
+		success
+		echo
+	fi
 ;;
 stop)
 	cmanremove=""
 	stop && rm -f $LOCK_FILE
+	if [ "$INITLOGLEVEL" = "quiet" ]; then
+		success
+		echo
+	fi
 ;;
 restart|reload)
 	cmanremove=remove


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-27 19:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-27 19:16 cluster: STABLE3 - cman init: allow users to set the init script loglevel Fabio M. Di Nitto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).