Eventscript functions: add optional version to nfs_check_rpc_service()
authorMartin Schwenke <martin@meltin.net>
Tue, 8 May 2012 04:53:58 +0000 (14:53 +1000)
committerMartin Schwenke <martin@meltin.net>
Fri, 11 May 2012 00:33:27 +0000 (10:33 +1000)
This can be optional because the 1st item of each action-triple is a
test comparison that starts with '-'.

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

index ca89c38379b14694da1cd8e178334c85dc8f889b..9c2898cca2778212a11c12cc3fae9e108db25237 100755 (executable)
@@ -211,14 +211,20 @@ nfs_check_rpc_service ()
 {
     _prog_name="$1" ; shift
 
-    _version=1
+    _v=""
+    case "$1" in
+       -*) : ;;
+       *) _v="$1" ; shift ;;
+    esac
+
+    _version=${_v:-1}
     _rpc_prog="$_prog_name"
     _restart=""
     _opts=""
     case "$_prog_name" in
        knfsd)
            _rpc_prog=nfs
-           _version=3
+           _version=${_v:-3}
            _restart="echo 'Trying to restart NFS service'"
            _restart="${_restart}; startstop_nfs restart"
            ;;
@@ -230,7 +236,7 @@ nfs_check_rpc_service ()
            ;;
        lockd)
            _rpc_prog=nlockmgr
-           _version=4
+           _version=${_v:-4}
            _restart="echo 'Trying to restart lock manager service'"
            _restart="${_restart}; startstop_nfslock restart"
            ;;