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

sathieu at alioth.debian.org sathieu at alioth.debian.org
Tue Oct 18 19:32:15 UTC 2011


Author: sathieu
Date: 2011-10-18 19:32:15 +0000 (Tue, 18 Oct 2011)
New Revision: 3932

Modified:
   trunk/ctdb/debian/ctdb.init
Log:
ctdb.init : rename running() to is_running(), and move ctdb ping checks to is_ready()

Modified: trunk/ctdb/debian/ctdb.init
===================================================================
--- trunk/ctdb/debian/ctdb.init	2011-10-15 17:07:57 UTC (rev 3931)
+++ trunk/ctdb/debian/ctdb.init	2011-10-18 19:32:15 UTC (rev 3932)
@@ -274,7 +274,7 @@
     _timeout="${1:-10}" # default is 10 seconds
 
     _count=0
-    while ! ctdb ping >/dev/null 2>&1 ; do
+    while ! is_ready ; do
 	if [ $_count -ge $_timeout ] ; then
 	    return 1
 	fi
@@ -293,11 +293,15 @@
     done
 }
 
-running() {
+is_running() {
     pkill -0 -f $ctdbd || return 1
     return 0
 }
 
+is_ready() {
+    ctdb ping >/dev/null 2>&1 || return 1
+}
+
 start_ctdbd() {
     build_ctdb_options
 
@@ -367,7 +371,7 @@
         start-stop-daemon --stop --quiet --exec $ctdbd
         RETVAL=$?
     fi
-    while running ; do
+    while is_running ; do
         sleep 1
         count=$(($count + 1))
         [ $count -gt 10 ] && {
@@ -400,12 +404,12 @@
     start)
         log_daemon_msg "Starting $DESC " "$NAME"
         # Check if it's running first
-        if running ;  then
+        if is_running ;  then
             log_progress_msg "already running"
             log_end_msg 0
             exit 0
         fi
-        if start_ctdbd && running ;  then
+        if start_ctdbd && is_running ;  then
             # It's ok, the server started and is running
             log_end_msg 0
         else
@@ -416,7 +420,7 @@
         ;;
     stop)
         log_daemon_msg "Stopping $DESC" "$NAME"
-        if running ; then
+        if is_running ; then
             # Only stop the server if we see it running
             stop_ctdbd
             log_end_msg $?
@@ -429,14 +433,14 @@
         ;;
     restart|reload|force-reload)
         log_daemon_msg "Restarting $DESC" "$NAME"
-        running && stop_ctdbd
+        is_running && stop_ctdbd
         start_ctdbd
-        running
+        is_running
         log_end_msg $?
         ;;
     status)
         log_daemon_msg "Checking status of $DESC" "$NAME"
-        if running ;  then
+        if is_running ;  then
             log_progress_msg "running"
             echo
             ctdb status
@@ -448,7 +452,7 @@
         fi
  	    ;;
     condrestart)
-        if running ;  then
+        if is_running ;  then
             log_daemon_msg "Restarting $DESC" "$NAME"
             stop_ctdbd
             start_ctdbd
@@ -457,9 +461,9 @@
         ;;
     cron)
         # used from cron to auto-restart ctdb
-        if ! running ; then
+        if ! is_running ; then
             log_daemon_msg "Starting $DESC " "$NAME"
-            if start_ctdbd && running ;  then
+            if start_ctdbd && is_running ;  then
                 # It's ok, the server started and is running
                 log_end_msg 0
             else





More information about the Pkg-samba-maint mailing list