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 is_no "${NETWORKING}"; then
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.
39 # Check if the service is already running?
40 if [ ! -f /var/lock/subsys/nfs ]; then
42 if [ "$NFSDTYPE" = "U" ] ; then
43 msg_starting "NFS mountd"
45 msg_starting "NFS daemon"
49 daemon /usr/sbin/exportfs -r
50 msg_starting "NFS mountd"
51 daemon rpc.mountd $RPCMOUNTDOPTS
52 msg_starting "NFS daemon"
53 daemon rpc.nfsd $RPCNFSDCOUNT
55 touch /var/lock/subsys/nfs
57 msg_Already_Running "NFS"
62 if [ -f /var/lock/subsys/nfs ]; then
64 if [ "$NFSDTYPE" = "U" ] ; then
65 msg_stopping "NFS mountd"
67 msg_stopping "NFS daemon"
70 msg_stopping "NFS mountd"
72 msg_stopping "NFS daemon"
75 daemon /usr/sbin/exportfs -au
77 rm -f /var/lock/subsys/nfs
85 if [ "$NFSDTYPE" = "U" ] ; then
92 if [ "$NFSDTYPE" = "U" ] ; then
96 show "Restarting NFS services (killing)"
98 show "Restarting NFS services (starting)"
99 daemon rpc.mountd $RPCMOUNTDOPTS
100 /usr/sbin/exportfs -r
101 touch /var/lock/subsys/nfs
105 [ "$NFSDTYPE" = "U" ] && exit 0
107 touch /var/lock/subsys/nfs
110 [ "$NFSDTYPE" = "U" ] && exit 0
111 if [ ! -f /var/lock/subsys/nfs ] ; then
114 /sbin/pidof rpc.mountd >/dev/null 2>&1; MOUNTD="$?"
115 /sbin/pidof nfsd >/dev/null 2>&1; NFSD="$?"
116 if [ $MOUNTD = 1 -o $NFSD = 1 ] ; then
119 if [ /etc/exports -nt /var/lock/subsys/nfs ] ; then
124 msg_usage "$0 {start|stop|status|restart|reload|probe}"