]> git.decadent.org.uk Git - nfs-utils.git/blob - etc/redhat/nfs.init
2000-06-27 H.J. Lu <hjl@lucon.org>
[nfs-utils.git] / etc / redhat / nfs.init
1 #!/bin/sh
2 #
3 # nfs           This shell script takes care of starting and stopping
4 #               the NFS services.
5 #
6 # chkconfig: - 60 20
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.
10 # probe: true
11
12 # Source function library.
13 . /etc/rc.d/init.d/functions
14
15 # Source networking configuration.
16 if [ ! -f /etc/sysconfig/network ]; then
17     exit 0
18 fi
19
20 . /etc/sysconfig/network
21
22 # Check that networking is up.
23 [ ${NETWORKING} = "no" ] && exit 0
24
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
29
30 # Number of servers to be started up by default
31 RPCNFSDCOUNT=8
32 # No NFS V3.
33 RPCMOUNTDOPTS="--no-nfs-version 3"
34
35 # See how we were called.
36 case "$1" in
37   start)
38         # Start daemons.
39         echo -n "Starting NFS quotas: "
40         daemon rpc.rquotad
41         echo
42         echo -n "Starting NFS mountd: "
43         daemon rpc.mountd $RPCMOUNTDOPTS
44         echo
45         echo -n "Starting NFS daemon: "
46         daemon rpc.nfsd $RPCNFSDCOUNT
47         echo
48         action "Starting NFS services: " /usr/sbin/exportfs -r
49         touch /var/lock/subsys/nfs
50         ;;
51   stop)
52         # Stop daemons.
53         action "Shutting down NFS services: " /usr/sbin/exportfs -au
54         echo -n "Shutting down NFS mountd: "
55         killproc rpc.mountd
56         echo
57         echo -n "Shutting down NFS daemon: "
58         killproc nfsd
59         echo
60         echo -n "Shutting down NFS quotas: "
61         killproc rpc.rquotad
62         echo
63         rm -f /var/lock/subsys/nfs
64         ;;
65   status)
66         status rpc.mountd
67         status nfsd
68         status rpc.rquotad
69         ;;
70   restart)
71         $0 stop
72         $0 start
73         ;;
74   reload)
75         /usr/sbin/exportfs -r
76         touch /var/lock/subsys/nfs
77         ;;
78   probe)
79         if [ ! -f /var/lock/subsys/nfs ] ; then
80           echo start; exit 0
81         fi
82         /sbin/pidof rpc.mountd >/dev/null 2>&1; MOUNTD="$?"
83         /sbin/pidof nfsd >/dev/null 2>&1; NFSD="$?"
84         if [ $MOUNTD = 1 -o $NFSD = 1 ] ; then
85           echo restart; exit 0
86         fi
87         if [ /etc/exports -nt /var/lock/subsys/nfs ] ; then
88           echo reload; exit 0
89         fi
90         ;;
91   *)
92         echo "Usage: nfs {start|stop|status|restart|reload}"
93         exit 1
94 esac
95
96 exit 0