[Pkg-samba-maint] r2093 - trunk/ctdb/debian

mparent-guest at alioth.debian.org mparent-guest at alioth.debian.org
Fri Aug 1 18:47:59 UTC 2008


Author: mparent-guest
Date: 2008-08-01 18:47:59 +0000 (Fri, 01 Aug 2008)
New Revision: 2093

Modified:
   trunk/ctdb/debian/ctdb.init
Log:
Small changes to better match upstream init script


Modified: trunk/ctdb/debian/ctdb.init
===================================================================
--- trunk/ctdb/debian/ctdb.init	2008-08-01 12:21:08 UTC (rev 2092)
+++ trunk/ctdb/debian/ctdb.init	2008-08-01 18:47:59 UTC (rev 2093)
@@ -1,4 +1,4 @@
-#!/bin/sh 
+#!/bin/sh
 #
 # based on the ''Example init.d script with LSB support.''
 #
@@ -20,14 +20,14 @@
 # Suite 330, Boston, MA 02111-1307 USA
 #
 ### BEGIN INIT INFO
-# Provides:          ctdb
-# Required-Start:    $network $local_fs $remote_fs
-# Required-Stop:     $network $local_fs $remote_fs
-# Should-Start:      
-# Should-Stop:       
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: start ctdb daemon
+# Provides:       ctdb
+# Required-Start: $network $local_fs $remote_fs
+# Required-Stop:  $network $local_fs $remote_fs
+# Should-Start:
+# Should-Stop:
+# Default-Start:  2 3 4 5
+# Default-Stop:   0 1 6
+# Description:    initscript for the ctdb service
 ### END INIT INFO
 
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@@ -42,11 +42,15 @@
 
 . /lib/lsb/init-functions
 
+# Avoid using root's TMPDIR
+unset TMPDIR
+
 [ -z "$CTDB_BASE" ] && {
     export CTDB_BASE="/etc/ctdb"
 }
 
 . $CTDB_BASE/functions
+loadconfig ctdb
 
 # Default options, these can be overriden by the information
 # at /etc/default/$NAME
@@ -56,11 +60,6 @@
 #DAEMONUSER=ctdb   # Users to run the daemons as. If this value
                         # is set start-stop-daemon will chuid the server
 
-# Include defaults if available
-if [ -f /etc/default/$NAME ] ; then
-	. /etc/default/$NAME
-fi
-
 [ -z "$CTDB_RECOVERY_LOCK" ] && {
     echo "You must configure the location of the CTDB_RECOVERY_LOCK"
     exit 1
@@ -80,7 +79,7 @@
 [ -z "$CTDB_TRANSPORT" ]        || CTDB_OPTIONS="$CTDB_OPTIONS --transport $CTDB_TRANSPORT"
 [ -z "$CTDB_DEBUGLEVEL" ]       || CTDB_OPTIONS="$CTDB_OPTIONS -d $CTDB_DEBUGLEVEL"
 [ -z "$CTDB_START_AS_DISABLED" ] || [ "$CTDB_START_AS_DISABLED" != "yes" ] || {
-        CTDB_OPTIONS="$CTDB_OPTIONS --start-as-disabled"
+	CTDB_OPTIONS="$CTDB_OPTIONS --start-as-disabled"
 }
 [ -z "$CTDB_CAPABILITY_RECMASTER" ] || [ "$CTDB_CAPABILITY_RECMASTER" != "no" ] || {
 	CTDB_OPTIONS="$CTDB_OPTIONS --no-recmaster"
@@ -89,7 +88,7 @@
 	CTDB_OPTIONS="$CTDB_OPTIONS --no-lmaster"
 }
 [ -z "$CTDB_LVS_PUBLIC_IP" ] || {
-       CTDB_OPTIONS="$CTDB_OPTIONS --lvs"
+	CTDB_OPTIONS="$CTDB_OPTIONS --lvs"
 }
 
 # Check that the user exists (if we set a user)
@@ -113,7 +112,7 @@
     return 1
 }
 
-start_server() {
+start() {
         # check all persistent databases that they look ok
         PERSISTENT_DB_DIR="/var/lib/ctdb/persistent"
         [ -z "$CTDB_DBDIR" ] || {
@@ -133,13 +132,13 @@
 	else if [ -z "$DAEMONUSER" ] ; then
             start-stop-daemon --start --quiet --background \
                         --exec $DAEMON -- $CTDB_OPTIONS
-            errcode=$?
+            RETVAL=$?
         else
 # if we are using a daemonuser then change the user id
             start-stop-daemon --start --quiet --background \
                         --chuid $DAEMONUSER \
                         --exec $DAEMON -- $CTDB_OPTIONS
-            errcode=$?
+            RETVAL=$?
         fi
 	fi
 	sleep 1
@@ -148,15 +147,15 @@
 	while read v; do
 	    varname=`echo $v | cut -d= -f1`
 	    value=`echo $v | cut -d= -f2`
-	    ctdb setvar $varname $value || errcode=1
+	    ctdb setvar $varname $value || RETVAL=1
 	done || exit 1
-	return $errcode
+	return $RETVAL
 }
 
-stop_server() {
+stop() {
 # Stop the process using the wrapper
         ctdb shutdown
-	errcode=$?
+	RETVAL=$?
         if [ "$CTDB_VALGRIND" = "yes" ]; then
 	    # very crude method
 	    sleep 2
@@ -164,13 +163,13 @@
 	else if [ -z "$DAEMONUSER" ] ; then
             start-stop-daemon --stop --quiet \
                         --exec $DAEMON
-            errcode=$?
+            RETVAL=$?
         else
 # if we are using a daemonuser then look for process that match
             start-stop-daemon --stop --quiet \
                         --user $DAEMONUSER \
                         --exec $DAEMON
-            errcode=$?
+            RETVAL=$?
         fi
 	fi
 	count=0
@@ -184,7 +183,7 @@
 	    }
 	done
 
-	return $errcode
+	return $RETVAL
 }
 
 case "$1" in
@@ -196,7 +195,7 @@
             log_end_msg 0
             exit 0
         fi
-        if start_server && running ;  then
+        if start && running ;  then
             # It's ok, the server started and is running
             log_end_msg 0
         else
@@ -212,7 +211,7 @@
         log_daemon_msg "Stopping $DESC" "$NAME"
         if running ; then
             # Only stop the server if we see it running
-            stop_server
+            stop
             log_end_msg $?
         else
             # If it's not running don't do anything
@@ -223,8 +222,8 @@
         ;;
   restart|force-reload)
         log_daemon_msg "Restarting $DESC" "$NAME"
-        running && stop_server
-        start_server
+        running && stop
+        start
         running
         log_end_msg $?
 	;;
@@ -249,4 +248,4 @@
 	;;
 esac
 
-exit 0
+exit $?




More information about the Pkg-samba-maint mailing list