[ctdb][PATCH] Fixes for init script to meet guidelines

Sumit Bose sbose at redhat.com
Fri Feb 5 03:24:21 MST 2010


On Wed, Nov 25, 2009 at 09:52:19AM +0100, Sumit Bose wrote:
> Hi,
> 
> this patch add various fixes to the ctdb init script with the aim to
> increase the conformance to the init script guidelines of openSUSE
> (http://en.opensuse.org/Packaging/SysV_Init_Script) and Fedora
> (https://fedoraproject.org/wiki/Packaging/SysVInitScript).
> 
> bye,
> Sumit

This is a rebased version which should cleanly apply to the current
master.

bye,
Sumit
-------------- next part --------------
From 721527d3af07687419163bd4d140848f88fdd12e Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Tue, 24 Nov 2009 23:11:28 +0100
Subject: [PATCH] Fixes for init script to meet guidelines

---
 config/ctdb.init |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/config/ctdb.init b/config/ctdb.init
index b4df177..89c826b 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -171,7 +171,7 @@ start() {
 
     ctdb ping >/dev/null 2>&1 && {
 	echo $"CTDB is already running"
-	return 1
+	return 0
     }
 
     build_ctdb_options
@@ -215,7 +215,7 @@ start() {
     set_ctdb_variables
 
     return $RETVAL
-}	
+}
 
 stop() {
     echo -n $"Shutting down ctdbd service: "
@@ -262,20 +262,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
@@ -292,13 +298,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)
@@ -306,7 +312,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.6



More information about the samba-technical mailing list