- wait for winbind on samba start
authorAndrew Tridgell <tridge@samba.org>
Sun, 17 Jun 2007 01:57:42 +0000 (11:57 +1000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 17 Jun 2007 01:57:42 +0000 (11:57 +1000)
- use $PATH for ctdb status

(This used to be ctdb commit cf8d837cead1cbcb22c71ebbc3947970d1a565a3)

ctdb/config/events.d/50.samba
ctdb/config/functions

index 0c48252a763ec4449aa1b39459bdfb681910fc7c..df2d8b23cdba1e8cb133db9dfe38ac5294aca7c5 100755 (executable)
@@ -30,6 +30,9 @@ case $cmd in
        # wait for the Samba tcp ports to become available
        smb_ports=`testparm -sv 2> /dev/null | egrep '\s*smb ports =' | cut -d= -f2`
        ctdb_wait_tcp_ports "Samba" $smb_ports
+
+       # wait for winbind to be ready
+       ctdb_wait_command "winbind" "wbinfo -p"
        ;;
        
      takeip)
index 4219f2238388796b8e7eda895e75cb2b08bfcaa7..ce292bc5fe602d4d01a5255a7abd6d6361e63858 100644 (file)
@@ -26,6 +26,28 @@ service() {
   fi
 }
 
+
+######################################################
+# wait for a command to return a zero exit status
+# usage: ctdb_wait_command SERVICE_NAME <command>
+######################################################
+ctdb_wait_command() {
+  service_name="$1"
+  wait_cmd="$2"
+  [ -z "$wait_cmd" ] && return;
+  all_ok=0
+  echo "`/bin/date` Waiting for service $service_name to start"
+  while [ $all_ok -eq 0 ]; do
+         $wait_cmd > /dev/null 2>&1 && all_ok=1
+         ctdb status > /dev/null 2>&1 || {
+               echo "ctdb daemon has died. Exiting wait for $service_name"
+               exit 1
+         }
+  done
+  echo "`/bin/date` Local service $service_name is up"
+}
+
+
 ######################################################
 # wait for a set of tcp ports
 # usage: ctdb_wait_tcp_ports SERVICE_NAME <ports...>
@@ -50,7 +72,7 @@ ctdb_wait_tcp_ports() {
              fi
          done
          [ $all_ok -eq 1 ] || sleep 1
-         /usr/bin/ctdb status > /dev/null 2>&1 || {
+         ctdb status > /dev/null 2>&1 || {
                echo "ctdb daemon has died. Exiting tcp wait $service_name"
                exit 1
          }
@@ -77,7 +99,7 @@ ctdb_wait_directories() {
              [ -d $d ] || all_ok=0
          done
          [ $all_ok -eq 1 ] || sleep 1
-         /usr/bin/ctdb status > /dev/null 2>&1 || {
+         ctdb status > /dev/null 2>&1 || {
                echo "ctdb daemon has died. Exiting directory wait for $service_name"
                exit 1
          }