samba-cvs.cvs
[Top] [All Lists]

Rev 544: - wait for winbind on samba start in http://samba.org/~tridge/c

Subject: Rev 544: - wait for winbind on samba start in http://samba.org/~tridge/ctdb
From:
Date: Sun, 17 Jun 2007 11:57:43 +1000
------------------------------------------------------------
revno: 544
revision-id: tridge@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
parent: tridge@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
committer: Andrew Tridgell <tridge@xxxxxxxxx>
branch nick: tridge
timestamp: Sun 2007-06-17 11:57:42 +1000
message:
  - wait for winbind on samba start
  - use $PATH for ctdb status
modified:
  config/events.d/50.samba       samba-20070601105340-vlcvnp6euoj3zdwy-3
  config/functions               functions-20070601105405-gajwirydr5a9zd6x-1
=== modified file 'config/events.d/50.samba'
--- a/config/events.d/50.samba  2007-06-11 03:56:50 +0000
+++ b/config/events.d/50.samba  2007-06-17 01:57:42 +0000
@@ -30,6 +30,9 @@
        # 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)

=== modified file 'config/functions'
--- a/config/functions  2007-06-06 02:08:42 +0000
+++ b/config/functions  2007-06-17 01:57:42 +0000
@@ -26,6 +26,28 @@
   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 @@
              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 @@
              [ -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
          }

<Prev in Thread] Current Thread [Next in Thread>
  • Rev 544: - wait for winbind on samba start in http://samba.org/~tridge/ctdb, tridge <=