This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
cluster: STABLE3 - cman init: allow users to set the init scriptloglevel
- From: "Fabio M. Di Nitto" <fabbione at fedoraproject dot org>
- To: cluster-cvs-relay at redhat dot com
- Date: Fri, 27 Mar 2009 19:06:59 +0000 (UTC)
- Subject: cluster: STABLE3 - cman init: allow users to set the init scriptloglevel
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