3 # nfs This shell script takes care of starting and stopping
7 # description: NFS is a popular protocol for file sharing across TCP/IP \
8 # networks. This service provides NFS server functionality, \
9 # which is configured via the /etc/exports file.
12 # Source function library.
13 . /etc/rc.d/init.d/functions
15 # Source networking configuration.
16 if [ ! -f /etc/sysconfig/network ]; then
20 . /etc/sysconfig/network
22 # Check that networking is up.
23 [ ${NETWORKING} = "no" ] && exit 0
25 [ -x /usr/sbin/rpc.nfsd ] || exit 0
26 [ -x /usr/sbin/rpc.mountd ] || exit 0
27 [ -x /usr/sbin/exportfs ] || exit 0
28 [ -s /etc/exports ] || exit 0
30 RQUOTAD=`type -path rpc.rquotad` # Remote quota server
32 # Number of servers to be started up by default
34 # Default to NFS version 3.
37 # See how we were called.
41 action "Starting NFS services: " /usr/sbin/exportfs -r
42 if [ -n "$RQUOTAD" ]; then
43 echo -n "Starting NFS quotas: "
47 echo -n "Starting NFS daemon: "
48 daemon rpc.nfsd $RPCNFSDCOUNT
51 # Let's see if we support NFS version 3.
52 /usr/sbin/rpcinfo -u localhost nfs 3 &>/dev/null
54 RPCMOUNTDOPTS="--no-nfs-version 3"
57 echo -n "Starting NFS mountd: "
58 daemon rpc.mountd $RPCMOUNTDOPTS
60 touch /var/lock/subsys/nfs
64 echo -n "Shutting down NFS mountd: "
67 echo -n "Shutting down NFS daemon: "
70 if [ -n "$RQUOTAD" ]; then
71 echo -n "Shutting down NFS quotas: "
75 # Do it the last so that clients can still access the server
76 # when the server is running.
77 action "Shutting down NFS services: " /usr/sbin/exportfs -au
78 rm -f /var/lock/subsys/nfs
83 if [ -n "$RQUOTAD" ]; then
93 touch /var/lock/subsys/nfs
96 if [ ! -f /var/lock/subsys/nfs ] ; then
99 /sbin/pidof rpc.mountd >/dev/null 2>&1; MOUNTD="$?"
100 /sbin/pidof nfsd >/dev/null 2>&1; NFSD="$?"
101 if [ $MOUNTD = 1 -o $NFSD = 1 ] ; then
104 if [ /etc/exports -nt /var/lock/subsys/nfs ] ; then
109 echo "Usage: nfs {start|stop|status|restart|reload}"