X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=etc%2Fredhat%2Fnfs.init;h=836d60de4e7ed479aef9b67405e11324962e09c0;hb=df07daea1421c80ecf308a6daf3ab3fa7d4cfd65;hp=6da8e0c0f7d42d7313b130d7cd1468ddf8301856;hpb=8b7ad01b14df1e7529b9ba8a1ea17df0d6004ef9;p=nfs-utils.git diff --git a/etc/redhat/nfs.init b/etc/redhat/nfs.init index 6da8e0c..836d60d 100755 --- a/etc/redhat/nfs.init +++ b/etc/redhat/nfs.init @@ -27,10 +27,10 @@ fi [ -x /usr/sbin/exportfs ] || exit 0 [ -s /etc/exports ] || exit 0 -# Number of servers to be started uo by default +# Number of servers to be started up by default RPCNFSDCOUNT=8 -# No NFS V3. -RPCMOUNTDOPTS="--no-nfs-version 3" +# Default to NFS version 3. +RPCMOUNTDOPTS="" # See how we were called. case "$1" in @@ -40,17 +40,29 @@ case "$1" in echo -n "Starting NFS quotas: " daemon rpc.rquotad echo - echo -n "Starting NFS mountd: " - daemon rpc.mountd $RPCMOUNTDOPTS - echo echo -n "Starting NFS daemon: " daemon rpc.nfsd $RPCNFSDCOUNT echo + + # Let's see if we support NFS version 3. + /usr/sbin/rpcinfo -u localhost nfs 3 &>/dev/null + if [ $? -ne 0 ]; then + RPCMOUNTDOPTS="--no-nfs-version 3" + fi + + # Let's see if we support NFS version 3. + /usr/sbin/rpcinfo -p localhost | grep nfs | grep tcp &>/dev/null + if [ $? -ne 0 ]; then + RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-tcp" + fi + + echo -n "Starting NFS mountd: " + daemon rpc.mountd $RPCMOUNTDOPTS + echo touch /var/lock/subsys/nfs ;; stop) # Stop daemons. - action "Shutting down NFS services: " /usr/sbin/exportfs -au echo -n "Shutting down NFS mountd: " killproc rpc.mountd echo @@ -60,6 +72,9 @@ case "$1" in echo -n "Shutting down NFS quotas: " killproc rpc.rquotad echo + # Do it the last so that clients can still access the server + # when the server is running. + action "Shutting down NFS services: " /usr/sbin/exportfs -au rm -f /var/lock/subsys/nfs ;; status) @@ -68,13 +83,8 @@ case "$1" in status rpc.rquotad ;; restart) - echo -n "Restarting NFS services: " - echo -n "rpc.mountd " - killproc rpc.mountd - daemon rpc.mountd $RPCMOUNTDOPTS - /usr/sbin/exportfs -r - touch /var/lock/subsys/nfs - echo "done." + $0 stop + $0 start ;; reload) /usr/sbin/exportfs -r @@ -99,4 +109,3 @@ case "$1" in esac exit 0 -