public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: "Fabio M. Di Nitto" <fabbione@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: cluster: STABLE3 - cman init: allow users to set the init script loglevel
Date: Fri, 27 Mar 2009 19:16:00 -0000	[thread overview]
Message-ID: <20090327190659.80C8C12020C@lists.fedorahosted.org> (raw)

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


                 reply	other threads:[~2009-03-27 19:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090327190659.80C8C12020C@lists.fedorahosted.org \
    --to=fabbione@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).