[PATCH] Fixes for init script to meet guidelines

Sumit Bose sbose at redhat.com
Tue Nov 24 15:11:28 MST 2009


---
 config/ctdb.init |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/config/ctdb.init b/config/ctdb.init
index 67747fd..ca2f0fc 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -137,7 +137,7 @@ start() {
 
     ctdb ping >/dev/null 2>&1 && {
 	echo $"CTDB is already running"
-	return 1
+	return 0
     }
 
     build_ctdb_options
@@ -153,7 +153,7 @@ start() {
     case $init_style in
 	valgrind)
 	    valgrind -q --log-file=/var/log/ctdb_valgrind \
-		$ctdbd --nosetsched $CTDB_OPTIONS 
+		$ctdbd --nosetsched $CTDB_OPTIONS
 	    RETVAL=$?
 	    echo
 	    ;;
@@ -180,7 +180,7 @@ start() {
     set_ctdb_variables
 
     return $RETVAL
-}	
+}
 
 stop() {
     echo -n $"Shutting down ctdbd service: "
@@ -227,20 +227,26 @@ stop() {
 restart() {
     stop
     start
-}	
+}
 
 status() {
     echo -n $"Checking for ctdbd service: "
     ctdb ping >/dev/null 2>&1 || {
 	RETVAL=$?
-	echo -n "  ctdbd not running. "
 	case $init_style in
 	    suse)
+		echo -n "  ctdbd not running. "
 		set_retval $RETVAL
 		rc_status -v
 		;;
 	    redhat)
-		echo ""
+		if [ -f /var/lock/subsys/ctdb ]; then
+			echo $"ctdb dead but subsys locked"
+			RETVAL=2
+		else
+			echo $"ctdb is stopped"
+			RETVAL=3
+		fi
 		;;
 	esac
 	return $RETVAL
@@ -257,13 +263,13 @@ case "$1" in
     stop)
   	stop
 	;;
-    restart|reload)
+    restart|reload|force-reload)
   	restart
 	;;
     status)
   	status
 	;;
-    condrestart)
+    condrestart|try-restart)
   	ctdb status > /dev/null && restart || :
 	;;
     cron)
@@ -271,7 +277,7 @@ case "$1" in
   	ctdb status > /dev/null || restart
 	;;
     *)
-	echo $"Usage: $0 {start|stop|restart|status|cron|condrestart}"
+	echo $"Usage: $0 {start|stop|restart|reload|force-reload|status|cron|condrestart|try-restart}"
 	exit 1
 esac
 
-- 
1.6.5.2


--IuhbYIxU28t+Kd57--


More information about the samba-technical mailing list