eventscripts: Move rpc.statd existence check into nfs_check_rpc_service ()
authorMartin Schwenke <martin@meltin.net>
Mon, 22 Apr 2013 19:54:12 +0000 (05:54 +1000)
committerMartin Schwenke <martin@meltin.net>
Mon, 6 May 2013 10:40:58 +0000 (20:40 +1000)
The code in 60.nfs is going to be genericised, so make all the checks
look the same.

Signed-off-by: Martin Schwenke <martin@meltin.net>
config/events.d/60.nfs
config/functions

index 2cba9a76f49af5addb49f85739a6ba1616caa51f..ac82b56dd9a8e2d71068196af699f1d605f1ac9b 100755 (executable)
@@ -78,16 +78,10 @@ case "$1" in
        update_tickles 2049
 
        # check that statd responds to rpc requests
-       # if statd is not running we try to restart it
-       # we only do this IF we have a rpc.statd command.
-       # For platforms where rpc.statd does not exist, we skip
-       # the check completely
-        p="rpc.statd"
-        which $p >/dev/null 2>/dev/null && \
-           nfs_check_rpc_service "statd" \
-               -ge 6 "verbose unhealthy" \
-               -eq 4 "verbose restart" \
-               -eq 2 "restart:bs"
+       nfs_check_rpc_service "statd" \
+           -ge 6 "verbose unhealthy" \
+           -eq 4 "verbose restart" \
+           -eq 2 "restart:bs"
 
        # check that NFS responds to rpc requests
        if [ "$CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK" != "yes" ] ; then
index 1f82034523495d4400577de7b92401e3c785b8fd..07ac715806c2679edf786444800dbf9369cac8ba 100755 (executable)
@@ -223,6 +223,12 @@ nfs_check_rpc_service ()
 {
     _prog_name="$1" ; shift
 
+    # Some platforms don't have separate programs for all services.
+    case "$_prog_name" in
+       statd)
+           which "rpc.${_prog_name}" >/dev/null 2>&1 || return 0
+    esac
+
     _v=""
     case "$1" in
        -*) : ;;