store the nfs tickles for 61.nfstickle in a background shell
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 23 Feb 2010 05:09:09 +0000 (16:09 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 23 Feb 2010 05:09:09 +0000 (16:09 +1100)
instead of blocking while it finishes.

this avoids having the eventscript hang/timeout if the underlying cluster filesystem hangs and blocks for 30+ seconds.

config/events.d/61.nfstickle

index 14794fe3066787f1ef4c4efad485eed3c077ef30..c91d3938a9e30bd431179cc8e0dbc7977022e0ae 100755 (executable)
@@ -15,6 +15,19 @@ ctdb_start_stop_service
 
 [ -z "$NFS_TICKLE_SHARED_DIRECTORY" ] && exit 0
 
+store_tickles()
+{
+       mydir=$NFS_TICKLE_SHARED_DIRECTORY/`hostname`
+       rm -f $mydir/*
+       # record our connections to shared storage
+       netstat -tn |egrep '^tcp[[:space:]]+[0-9]+[[:space:]]+[0-9]+[[:space:]]+[0-9\.]+:2049.*ESTABLISHED' |
+               awk '{print $4" "$5}' | 
+               while read dest src; do
+                       ip=${dest%:*}
+                       echo $src >> $mydir/$ip
+               done
+}
+
 case "$1" in 
      startup)
        ctdb_service_start
@@ -39,15 +52,7 @@ case "$1" in
        ;;
 
      monitor)
-       mydir=$NFS_TICKLE_SHARED_DIRECTORY/`hostname`
-       rm -f $mydir/*
-       # record our connections to shared storage
-       netstat -tn |egrep '^tcp[[:space:]]+[0-9]+[[:space:]]+[0-9]+[[:space:]]+[0-9\.]+:2049.*ESTABLISHED' |
-               awk '{print $4" "$5}' | 
-               while read dest src; do
-                       ip=${dest%:*}
-                       echo $src >> $mydir/$ip
-               done
+       store_tickles &
        ;;
 
     *)