]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - etc/redhat/nfs.init
2001-06-27 H.J. Lu <hjl@lucon.org>
[nfs-utils.git] / etc / redhat / nfs.init
index 687b19904be2d57383a6c54be49daa2e39d27973..4ef8d4884cd73bd9c974c41669081cc76708dfa6 100755 (executable)
@@ -27,25 +27,36 @@ fi
 [ -x /usr/sbin/exportfs ] || exit 0
 [ -s /etc/exports ] || exit 0
 
-# Number of servers to be started uo by default
+RQUOTAD=`type -path rpc.rquotad`       # Remote quota server
+
+# 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
   start)
        # Start daemons.
        action "Starting NFS services: " /usr/sbin/exportfs -r
-       echo -n "Starting NFS quotas: "
-       daemon rpc.rquotad
+       if [ -n "$RQUOTAD" ]; then
+               echo -n "Starting NFS quotas: "
+               daemon rpc.rquotad
+               echo
+       fi
+       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
+
        echo -n "Starting NFS mountd: "
        daemon rpc.mountd $RPCMOUNTDOPTS
        echo
-       echo -n "Starting NFS daemon: "
-       daemon rpc.nfsd $RPCNFSDCOUNT
-       echo
        touch /var/lock/subsys/nfs
        ;;
   stop)
@@ -59,6 +70,8 @@ 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
        ;;
@@ -68,13 +81,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 +107,3 @@ case "$1" in
 esac
 
 exit 0
-