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

sathieu at alioth.debian.org sathieu at alioth.debian.org
Sat Mar 26 20:27:29 UTC 2011


Author: sathieu
Date: 2011-03-26 20:27:28 +0000 (Sat, 26 Mar 2011)
New Revision: 3727

Modified:
   trunk/ctdb/debian/changelog
   trunk/ctdb/debian/ctdb.init
Log:
ctdb.init: wait_until_ready before set_ctdb_variables

Modified: trunk/ctdb/debian/changelog
===================================================================
--- trunk/ctdb/debian/changelog	2011-03-26 20:10:56 UTC (rev 3726)
+++ trunk/ctdb/debian/changelog	2011-03-26 20:27:28 UTC (rev 3727)
@@ -18,7 +18,7 @@
   * New package ctdb-dev, add the corresponding Breaks and Replaces
   * d/ctdb.init: updated
 
- -- Mathieu Parent <sathieu at debian.org>  Sat, 26 Mar 2011 21:09:58 +0100
+ -- Mathieu Parent <sathieu at debian.org>  Sat, 26 Mar 2011 21:26:37 +0100
 
 ctdb (1.0.112-12-1) unstable; urgency=low
 

Modified: trunk/ctdb/debian/ctdb.init
===================================================================
--- trunk/ctdb/debian/ctdb.init	2011-03-26 20:10:56 UTC (rev 3726)
+++ trunk/ctdb/debian/ctdb.init	2011-03-26 20:27:28 UTC (rev 3727)
@@ -237,6 +237,19 @@
     return $1
 }
 
+wait_until_ready () {
+    _timeout="${1:-10}" # default is 10 seconds
+
+    _count=0
+    while ! ctdb ping >/dev/null 2>&1 ; do
+	if [ $_count -ge $_timeout ] ; then
+	    return 1
+	fi
+	sleep 1
+	_count=$(($_count + 1))
+    done
+}
+
 running() {
     pkill -0 -f $ctdbd || return 1
     return 0
@@ -276,9 +289,25 @@
 	    ;;
     esac
 
-    sleep 1
+    if [ $RETVAL -eq 0 ] ; then
+	if wait_until_ready ; then
+	    set_ctdb_variables
+	else
+	    RETVAL=1
+	    pkill -9 -f $ctdbd >/dev/null 2>&1
+	fi
+    fi
 
-    set_ctdb_variables
+    case $init_style in
+	suse)
+	    set_retval $RETVAL
+	    rc_status -v
+	    ;;
+	redhat)
+	    [ $RETVAL -eq 0 ] && success || failure
+	    echo
+	    ;;
+    esac
 
     return $RETVAL
 }	





More information about the Pkg-samba-maint mailing list