eventscripts: Change the nfsd RPC check failure policy
authorMartin Schwenke <martin@meltin.net>
Tue, 6 Aug 2013 06:46:21 +0000 (16:46 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Wed, 14 Aug 2013 06:15:14 +0000 (16:15 +1000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
config/events.d/60.nfs

index 3ae8f245067defec4062ac088061fbda5ce512cf..ac22b7b5e08826ac5bc0e45cb5be21d5ea230f91 100755 (executable)
@@ -104,29 +104,20 @@ case "$1" in
        }
 
        # check that NFS responds to rpc requests
-       [ "$CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK" = "yes" ] || {
+       if [ "$CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK" != "yes" ] ; then
            if ctdb_check_rpc "NFS" 100003 3 >/dev/null ; then
-               (service_name="nfs_knfsd"; ctdb_counter_init)
+               ctdb_counter_init "nfs_knfsd"
            else
-               (
-                       service_name="nfs_knfsd"
-                       ctdb_counter_incr
+               ctdb_counter_incr "nfs_knfsd"
 
-                       ctdb_check_counter_equal 2 || {
-                               echo "Trying to restart NFS service"
-                               startstop_nfs restart >/dev/null 2>&1 &
-                               exit 0
-                       }
+               if ! ctdb_check_counter "quiet" % 10 "nfs_knfsd" ; then
+                   echo "Trying to restart NFS service"
+                   startstop_nfs restart >/dev/null 2>&1 &
+               fi
 
-                       ctdb_check_counter_limit 5 quiet >/dev/null
-               ) || {
-                       echo "$ctdb_check_rpc_out"
-                       echo "Trying to restart NFS service"
-                       startstop_nfs restart
-                       exit 1
-               }
+               ctdb_check_counter "error" -ge 2 "nfs_knfsd"
            fi
-       }
+       fi
 
        # check that lockd responds to rpc requests
        if ctdb_check_rpc "LOCKD" 100021 1 >/dev/null ; then