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_yes "${NETWORKING}"; then
23 if [ ! -f /var/lock/subsys/network ]; then
31 if [ -x /sbin/pidof ] && [ "$1" != "stop" ]; then
32 [ -z "`/sbin/pidof portmap`" ] && nls "Error: portmap isn't running" && exit 0
36 [ -x /usr/sbin/rpc.nfsd ] || exit 0
37 [ -x /usr/sbin/rpc.mountd ] || exit 0
38 [ -f /etc/exports ] || exit 0
42 # See how we were called.
45 # Check if the service is already running?
46 if [ ! -f /var/lock/subsys/nfs ]; then
48 if [ "$NFSDTYPE" = "U" ] ; then
49 msg_starting "NFS mountd"
51 msg_starting "NFS daemon"
55 daemon /usr/sbin/exportfs -r
56 msg_starting "NFS mountd"
57 daemon rpc.mountd $RPCMOUNTDOPTS
58 msg_starting "NFS daemon"
59 daemon rpc.nfsd $RPCNFSDCOUNT
61 touch /var/lock/subsys/nfs
63 msg_already_running "NFS"
68 if [ -f /var/lock/subsys/nfs ]; then
70 if [ "$NFSDTYPE" = "U" ] ; then
71 msg_stopping "NFS mountd"
73 msg_stopping "NFS daemon"
76 msg_stopping "NFS mountd"
78 msg_stopping "NFS daemon"
81 daemon /usr/sbin/exportfs -au
83 rm -f /var/lock/subsys/nfs
91 if [ "$NFSDTYPE" = "U" ] ; then
102 [ "$NFSDTYPE" = "U" ] && exit 0
103 if [ -f /var/lock/subsys/nfs ]; then
108 [ $RETVAL -eq 0 ] && ok || died
110 msg_not_running "NFS"
115 [ "$NFSDTYPE" = "U" ] && exit 0
116 if [ ! -f /var/lock/subsys/nfs ] ; then
120 /sbin/pidof rpc.mountd >/dev/null 2>&1; MOUNTD="$?"
121 /sbin/pidof nfsd >/dev/null 2>&1; NFSD="$?"
122 if [ $MOUNTD = 1 -o $NFSD = 1 ] ; then
126 if [ /etc/exports -nt /var/lock/subsys/nfs ] ; then
132 msg_usage "$0 {start|stop|restart|reload|probe|status}"