------------------------------------------------------------
revno: 397
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell <[EMAIL PROTECTED]>
branch nick: tridge
timestamp: Wed 2007-05-30 12:27:58 +1000
message:
  wait for local tcp services like smbd to come up before allowing ctdb to 
start talking to other nodes
modified:
  common/ctdb_daemon.c           ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1
  tools/events                   events-20070529030121-04fjh63cxfh8v1pj-1
=== modified file 'common/ctdb_daemon.c'
--- a/common/ctdb_daemon.c      2007-05-29 07:23:29 +0000
+++ b/common/ctdb_daemon.c      2007-05-30 02:27:58 +0000
@@ -50,6 +50,12 @@
                return;
        }
 
+       ret = ctdb_event_script(ctdb, "startup");
+       if (ret != 0) {
+               DEBUG(0,("Failed startup event script\n"));
+               return;
+       }
+
        /* start the transport running */
        if (ctdb->methods->start(ctdb) != 0) {
                DEBUG(0,("transport failed to start!\n"));

=== modified file 'tools/events'
--- a/tools/events      2007-05-30 00:21:16 +0000
+++ b/tools/events      2007-05-30 02:27:58 +0000
@@ -1,10 +1,28 @@
 #!/bin/sh
 # sample event script for ctdb
 
+. /etc/sysconfig/ctdb
+
 cmd="$1"
 shift
 
 case $cmd in 
+     startup)
+       # wait for local services to come up
+       [ -z "$CTDB_WAIT_TCP_PORTS" ] || {
+         all_ok=0
+         while [ $all_ok -eq 0 ]; do
+                 all_ok=1
+                 for p in $CTDB_WAIT_TCP_PORTS; do
+                     /usr/bin/nc -z 127.0.0.1 $p || all_ok=0
+                 done
+                 [ $all_ok -eq 1 ] || sleep 1
+          done
+         echo "Local services on $CTDB_WAIT_TCP_PORTS are up"
+       }
+       exit 0; 
+       ;;
+       
      takeip)
        if [ $# != 3 ]; then
           echo "must supply interface, IP and maskbits"
@@ -13,6 +31,7 @@
        iface=$1
        ip=$2
        maskbits=$3
+
        /sbin/ip addr add $ip/$maskbits dev $iface || {
                 echo "Failed to add $ip/$maskbits on dev $iface"
                 exit 1

Reply via email to