]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
added CTDB_WAIT_DIRECTORIES support
authorAndrew Tridgell <tridge@samba.org>
Fri, 1 Jun 2007 03:50:18 +0000 (13:50 +1000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 1 Jun 2007 03:50:18 +0000 (13:50 +1000)
(This used to be ctdb commit fa888e8b1715d7460f5718d3e1fe17e4caaa15c3)

ctdb/packaging/RHEL/setup/ctdb.sysconfig
ctdb/tools/events

index f6d13142d3ba21c39af50065174254ee301e8f47..fdcbfbe8e0a98ee2796ae0eb932f99f2189a4fb0 100644 (file)
 # the default is not to wait for any local services
 # CTDB_WAIT_TCP_PORTS="445 139"
 
+# use this to specify any local directories to wait on before starting
+# ctdb. You should list any critical Samba or NFS shared directories 
+# the default is not to wait for any local directories
+# CTDB_WAIT_DIRECTORIES="/some/directory"
+
 # the shared directory where you want to put statd information on
 # which clients to notify on a NFS restart
 # there is no default
index 20c7653bb2aac4399b5de326dd659fae9b69b75d..30944bd188a5287a070a1dc12676db17965ce019 100755 (executable)
@@ -8,10 +8,10 @@ shift
 
 case $cmd in 
      startup)
-       # wait for local services to come up
+       # wait for local services to come up.
        [ -z "$CTDB_WAIT_TCP_PORTS" ] || {
          all_ok=0
-         echo "Waiting for tcp services on $CTDB_WAIT_TCP_PORTS to come up"
+         echo "Waiting for local tcp ports $CTDB_WAIT_TCP_PORTS"
          while [ $all_ok -eq 0 ]; do
                  all_ok=1
                  for p in $CTDB_WAIT_TCP_PORTS; do
@@ -23,7 +23,24 @@ case $cmd in
                        exit 1
                  }
           done
-         echo "Local tcp services on $CTDB_WAIT_TCP_PORTS are up"
+         echo "Local tcp services are up"
+       }
+       # wait for local directories to becomes available (could be slow to mount)
+       [ -z "$CTDB_WAIT_DIRECTORIES" ] || {
+         all_ok=0
+         echo "Waiting for local directories $CTDB_WAIT_DIRECTORIES"
+         while [ $all_ok -eq 0 ]; do
+                 all_ok=1
+                 for d in $CTDB_WAIT_DIRECTORIES; do
+                     [ -d $d ] || all_ok=0
+                 done
+                 [ $all_ok -eq 1 ] || sleep 1
+                 /usr/bin/ctdb status > /dev/null 2>&1 || {
+                       echo "ctdb daemon has died. Exiting event startup"
+                       exit 1
+                 }
+          done
+         echo "Local directories are available"
        }
        exit 0; 
        ;;