2 # nfs This shell script starts and stops the nfs services in a distribution
5 # description: starts and stops nfs server services
6 # chkconfig: 2345 60 20
8 # Copyright (c) 2000-2001 Mission Critical Linux, Inc.
11 PATH=/sbin:/bin:/usr/sbin:/usr/bin
15 SCRIPT_NAME=`basename $0`
17 # Grab our daemon functions.
18 . `dirname $0`/nfs-functions
20 # Kernel daemons and options
21 PREFIX="rpc." # Prefix for kernel execs (usually "rpc.")
22 NFSD="nfsd" # Kernel NFS Server
23 RPCNFSDCOUNT="8" # Number of nfsd threads
25 # User daemons and options
26 RQUOTAD="rpc.rquotad" # Remote quota server
27 MOUNTD="rpc.mountd" # Mount server
28 RPCMOUNTDOPTS="" # options for rpc.mountd
29 EXPORTFS="exportfs" # Exportfs command
31 SCRIPT_NAME=`basename $0`
32 DESC="NFS kernel daemon"
34 # We use "type -path" instead of "which" since it's internal to bash.
35 [ -x "`type -path $PREFIX$NFSD`" ] || exit 0
36 [ -x "`type -path $MOUNTD`" ] || exit 0
38 # Also make sure we have our exportfs command.
39 [ -x "`type -path $EXPORTFS`" ] || exit 0
40 [ -s /etc/exports ] || exit 0
42 # rquotad is not required for NFS to work, however.
43 # Unset if it is not present.
44 [ -x "`type -path $RQUOTAD`" ] || unset RQUOTAD
46 # Handle how we were called.
49 echo -n "Exporting directories for $DESC..."
53 echo -n "Starting $NFSD: "
54 startdaemon $PREFIX$NFSD $RPCNFSDCOUNT
56 # Disable NFSv3 on mountd if we don't have NFSv3
57 rpcinfo -u localhost nfs 3 &>/dev/null
60 RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-nfs-version 3"
62 echo -n "Starting $MOUNTD: "
63 startdaemon $MOUNTD $RPCMOUNTDOPTS
65 # Start rquotad if it is set
68 echo -n "Starting $RQUOTAD: "
72 # if this lock file doesn't exist, init won't even try to run
73 # the shutdown script for this service on RedHat systems!
74 # on non-RedHat systems, /var/lock/subsys may not exist.
75 touch /var/lock/subsys/$SCRIPT_NAME &> /dev/null
79 for process in $RQUOTAD $MOUNTD $NFSD
81 echo -n "Stopping $process: "
85 echo "Unexporting directories for $DESC..."
87 rm -f /var/lock/subsys/$SCRIPT_NAME
98 echo "Re-exporting directories for $DESC..."
100 touch /var/lock/subsys/$SCRIPT_NAME &> /dev/null
105 # First, check status of userland daemons
106 for process in $RQUOTAD $MOUNTD $NFSD
108 daemonstatus $process
114 echo "Usage: $0 {start|stop|status|restart|reload}"