]> git.pld-linux.org Git - packages/nfs-utils.git/blobdiff - nfs.init
- updated to 2.3.4
[packages/nfs-utils.git] / nfs.init
index 9dd2c454024de7cb397f4af8c03261ed248ff25a..e3019b211b31db5f3cc89e443276b7085488b799 100644 (file)
--- a/nfs.init
+++ b/nfs.init
@@ -3,7 +3,7 @@
 # nfs          This shell script takes care of starting and stopping
 #              the NFS services.
 #
-# chkconfig:   345 12 84
+# chkconfig:   345 13 81
 # description: NFS is a popular protocol for file sharing across TCP/IP \
 #              networks. This service provides NFS server functionality, \
 #              which is configured via the /etc/exports file.
 [ -f /etc/sysconfig/nfslock ] && . /etc/sysconfig/nfslock
 [ -f /etc/sysconfig/nfsd ] && . /etc/sysconfig/nfsd
 
-[ -n "$NFSv1" ] || NFSv1="yes"
-[ -n "$NFSv2" ] || NFSv2="yes"
-[ -n "$NFSv3" ] || NFSv3="yes"
-[ -n "$NFSv4" ] || NFSv4="yes"
-
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
        if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
@@ -34,59 +29,54 @@ else
        exit 0
 fi
 
-if [ -x /sbin/pidof ] && [ "$1" != "stop" ]; then
-       [ -z "`/sbin/pidof portmap`" ] && nls "Error: portmap isn't running" && exit 0
+if [ "$1" != "stop" ]; then
+       check_portmapper || { nls "Error: portmap isn't running" && exit 0; }
 fi
 
 start() {
        # Check if the service is already running?
-       if [ ! -f /var/lock/subsys/nfs ]; then
-               if ! grep -q nfsd /proc/mounts ; then
-                       modprobe -s nfsd > /dev/null 2>&1
-                       run_cmd "Mounting /proc/fs/nfsd filesystem" mount -t nfsd nfsd /proc/fs/nfsd
-               fi
-
-               # Set the ports lockd should listen on
-               if [ -n "$LOCKD_TCPPORT" ]; then
-                       /sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
-               fi
-               if [ -n "$LOCKD_UDPPORT" ]; then
-                       /sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1
-               fi
-
-               for vers in 1 2 3 4 ; do
-                       is_yes $(eval echo \$NFSv$vers) || \
-                               RPCMOUNTOPTIONS="$RPCMOUNTOPTIONS --no-nfs-version $vers"
-               done
+       if [ -f /var/lock/subsys/nfs ]; then
+               msg_already_running "NFS daemon"
+               return
+       fi
 
-               [ -n "$MOUNTD_PORT" ] && RPCMOUNTOPTIONS="$RPCMOUNTOPTIONS -p $MOUNTD_PORT"
+       if ! grep -q nfsd /proc/mounts ; then
+               modprobe -s nfsd > /dev/null 2>&1
+               run_cmd "Mounting /proc/fs/nfsd filesystem" mount -t nfsd nfsd /proc/fs/nfsd
+       fi
 
-               # Start daemons.
-               msg_starting "NFS exportfs"
-               daemon /usr/sbin/exportfs -r
-               msg_starting "NFS mountd"
-               daemon rpc.mountd $RPCMOUNTOPTIONS
-               msg_starting "NFS daemon"
-               daemon rpc.nfsd $RPCNFSDCOUNT
-               touch /var/lock/subsys/nfs
-       else
-               msg_already_running "NFS daemon"
+       # Set the ports lockd should listen on
+       if [ -n "$LOCKD_TCPPORT" ]; then
+               /sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
        fi
+       if [ -n "$LOCKD_UDPPORT" ]; then
+               /sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1
+       fi
+
+       # Start daemons.
+       msg_starting "NFS exportfs"
+       daemon /usr/sbin/exportfs -r
+       msg_starting "NFS mountd"
+       daemon /usr/sbin/rpc.mountd $RPCMOUNTDOPTIONS
+       msg_starting "NFS daemon"
+       daemon /usr/sbin/rpc.nfsd $RPCNFSDCOUNT
+       touch /var/lock/subsys/nfs
 }
 
 stop() {
-       if [ -f /var/lock/subsys/nfs ]; then
-               # Stop daemons.
-               msg_stopping "NFS daemon"
-               killproc nfsd -QUIT
-               msg_stopping "NFS mountd"
-               killproc rpc.mountd
-               msg_stopping "NFS"
-               daemon /usr/sbin/exportfs -au
-               rm -f /var/lock/subsys/nfs
-       else
+       if [ ! -f /var/lock/subsys/nfs ]; then
                msg_not_running "NFS"
+               return
        fi
+
+       # Stop daemons.
+       msg_stopping "NFS daemon"
+       killproc nfsd -QUIT
+       msg_stopping "NFS mountd"
+       killproc rpc.mountd
+       msg_stopping "NFS exportfs"
+       daemon /usr/sbin/exportfs -au
+       rm -f /var/lock/subsys/nfs
 }
 
 RETVAL=0
This page took 0.077369 seconds and 4 git commands to generate.