tools/ctdb: "ctdb runstate" now accepts optional expected run state arguments
[obnox/ctdb.git] / config / ctdb.init
index d92fef05ae7c99d905f0644d1d5dd08b0e6da982..70dcfa642169408d32bf773942764e59ecb8c110 100755 (executable)
@@ -130,17 +130,17 @@ select_tdb_checker ()
 {
     # Find the best TDB consistency check available.
     use_tdb_tool_check=false
-    if [ -x /usr/bin/tdbtool ] && \
-       echo "help" | /usr/bin/tdbtool | grep -q check ; then
+    if which tdbtool >/dev/null 2>&1 && \
+       echo "help" | tdbtool | grep -q check ; then
 
        use_tdb_tool_check=true
-    elif [ -x /usr/bin/tdbtool -a -x /usr/bin/tdbdump ] ; then
+    elif which tdbtool >/dev/null 2>&1 && which tdbdump >/dev/null 2>&1 ; then
            do_log <<EOF
 WARNING: The installed 'tdbtool' does not offer the 'check' subcommand.
  Using 'tdbdump' for database checks.
  Consider updating 'tdbtool' for better checks!
 EOF
-    elif [ -x /usr/bin/tdbdump ] ; then
+    elif which tdbdump >/dev/null 2>&1 ; then
        do_log <<EOF
 WARNING: 'tdbtool' is not available.
  Using 'tdbdump' to check the databases.
@@ -220,7 +220,7 @@ wait_until_ready () {
     _timeout="${1:-10}" # default is 10 seconds
 
     _count=0
-    while ! ctdb ping >/dev/null 2>&1 ; do
+    while ! ctdb runstate startup running >/dev/null 2>&1 ; do
        if [ $_count -ge $_timeout ] ; then
            return 1
        fi
@@ -249,7 +249,7 @@ start() {
 
     # make sure we drop any ips that might still be held if previous
     # instance of ctdb got killed with -9 or similar
-    drop_all_public_ips
+    drop_all_public_ips "ctdb.init"
 
     if select_tdb_checker ; then
        check_persistent_databases || return $?
@@ -288,6 +288,7 @@ start() {
     if [ $RETVAL -eq 0 ] ; then
        if ! wait_until_ready ; then
            RETVAL=1
+           echo "Timed out waiting for initialisation - killing CTDB"
            pkill -9 -f $ctdbd >/dev/null 2>&1
        fi
     fi