From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19229 invoked by alias); 27 Mar 2009 19:16:44 -0000 Received: (qmail 19215 invoked by alias); 27 Mar 2009 19:16:44 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion.fedora.phx.redhat.com Subject: cluster: STABLE3 - cman init: allow users to set the init script loglevel To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE3 X-Git-Reftype: branch X-Git-Oldrev: a63444d50d2ea6daa279e5f83f0f482aab5acea5 X-Git-Newrev: fec01964ef122758a5ddd7fd291ed203cb556ffc From: "Fabio M. Di Nitto" Message-Id: <20090327190659.80C8C12020C@lists.fedorahosted.org> Date: Fri, 27 Mar 2009 19:16:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q1/txt/msg00965.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=fec01964ef122758a5ddd7fd291ed203cb556ffc Commit: fec01964ef122758a5ddd7fd291ed203cb556ffc Parent: a63444d50d2ea6daa279e5f83f0f482aab5acea5 Author: Fabio M. Di Nitto AuthorDate: Thu Mar 26 13:40:01 2009 +0100 Committer: Fabio M. Di Nitto 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 --- 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