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]

master - cman notify: fix a few bits in the shell area


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=cd9f377363c38502b857527209d1531412125987
Commit:        cd9f377363c38502b857527209d1531412125987
Parent:        3fec6e6edb042158be584d6eeb40e478a54835e0
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Tue Nov 4 09:16:00 2008 +0100
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Tue Nov 4 09:16:00 2008 +0100

cman notify: fix a few bits in the shell area

Fix cman_notify NOTIFYDIR typo.

Fix cman_notify log redirection.

Fix cman_notify_template.sh log redirection.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 cman/notifyd/cman_notify.in |   10 +++++-----
 doc/cman_notify_template.sh |   10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/cman/notifyd/cman_notify.in b/cman/notifyd/cman_notify.in
index 86d848b..9e05bc0 100644
--- a/cman/notifyd/cman_notify.in
+++ b/cman/notifyd/cman_notify.in
@@ -9,7 +9,6 @@ if [ ! -d "@NOTIFYDDIR@" ]; then
 	exit 0
 fi
 
-OUT="/dev/null 2>&1"
 LOGFILE="@LOGDIR@/cman_notify.log"
 
 if [ "$CMAN_NOTIFICATION_DEBUG" = "1" ]; then
@@ -17,7 +16,7 @@ if [ "$CMAN_NOTIFICATION_DEBUG" = "1" ]; then
 fi
 
 # Ignore *~ and *, scripts
-for i in $(LC_ALL=C; echo @NOTIFYDIR@/*[^~,]); do
+for i in $(LC_ALL=C; echo @NOTIFYDDIR@/*[^~,]); do
 	[ -d $i ] && continue
 	# skip know scripts
 	[ "${i%.cfsaved}" != "${i}" ] && continue
@@ -31,9 +30,10 @@ for i in $(LC_ALL=C; echo @NOTIFYDIR@/*[^~,]); do
 	[ "${i%.dpkg-new}" != "${i}" ] && continue
 
 	if [ -x $i ]; then
-		echo "starting $(basename $i)" > $LOGFILE
-		$i > $OUT
-		echo "finished $(basename $i)" > $LOGFILE
+		echo "starting $(basename $i)" >> $LOGFILE
+		[ -n "$OUT" ] && $i >> $OUT
+		[ -z "$OUT" ] && $i > /dev/null 2>&1
+		echo "finished $(basename $i)" >> $LOGFILE
 	fi
 done
 
diff --git a/doc/cman_notify_template.sh b/doc/cman_notify_template.sh
index 87e8a5a..0d32003 100644
--- a/doc/cman_notify_template.sh
+++ b/doc/cman_notify_template.sh
@@ -9,18 +9,18 @@
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
 
-# define a simple wrapper to echo
+# define a simple wrapper to echo that will log to file only if
+# debugging is enable.
 my_echo() {
-	echo $@ > $OUT
+	[ -n "$OUT" ] && echo $@ >> $OUT
 }
 
-# set the default output to null.
-OUT="/dev/null"
+LOGFILE="/var/log/cluster/file.log"
 
 # verify if you are running in debuggin mode
 if [ "$CMAN_NOTIFICATION_DEBUG" = "1" ]; then
 	# in debuggin mode, we want to see the whole output somewhere
-	OUT="/var/log/cluster/file.log"
+	OUT="$LOGFILE"
 	my_echo "debugging is enabled"
 fi
 


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