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
16 . /etc/sysconfig/network
19 [ -f /etc/sysconfig/nfsd ] && . /etc/sysconfig/nfsd
21 # Check that networking is up.
22 if [ "${NETWORKING}" = "no" ]; then
23 echo "WARNING: Networking is down. Knfsd can't be run"
27 if [ -x /sbin/pidof ] && [ "$1" != "stop" ]; then
28 [ -z "`/sbin/pidof portmap`" ] && echo "Error: portmap isn't running" && exit 0
32 [ -x /usr/sbin/rpc.nfsd ] || exit 0
33 [ -x /usr/sbin/rpc.mountd ] || exit 0
34 [ -f /etc/exports ] || exit 0
36 # See how we were called.
40 if [ NFSDTYPE = "U" ] ; then
41 show "Starting NFS mountd"
43 show "Starting NFS daemon"
46 show "Starting NFS services"
47 daemon /usr/sbin/exportfs -r
48 show "Starting NFS mountd"
49 daemon rpc.mountd $RPCMOUNTDOPTS
50 show "Starting NFS daemon"
51 daemon rpc.nfsd $RPCNFSDCOUNT
53 touch /var/lock/subsys/nfs
57 if [ NFSDTYPE = "U" ] ; then
58 show "Shutting down NFS mountd"
60 show "Shutting down NFS daemon"
63 show "Shutting down NFS services"
64 daemon /usr/sbin/exportfs -au
65 show "Shutting down NFS mountd"
67 show "Shutting down NFS daemon"
70 rm -f /var/lock/subsys/nfs
74 if [ NFSDTYPE = "U" ] ; then
81 if [ NFSDTYPE = "U" ] ; then
85 show "Restarting NFS services (killing)"
87 show "Restarting NFS services (starting)"
88 daemon rpc.mountd $RPCMOUNTDOPTS
90 touch /var/lock/subsys/nfs
94 [ NFSDTYPE = "U" ] && exit 0
96 touch /var/lock/subsys/nfs
99 [ NFSDTYPE = "U" ] && exit 0
100 if [ ! -f /var/lock/subsys/nfs ] ; then
103 /sbin/pidof rpc.mountd >/dev/null 2>&1; MOUNTD="$?"
104 /sbin/pidof nfsd >/dev/null 2>&1; NFSD="$?"
105 if [ $MOUNTD = 1 -o $NFSD = 1 ] ; then
108 if [ /etc/exports -nt /var/lock/subsys/nfs ] ; then
113 echo "Usage: nfs {start|stop|status|restart|reload}"