2 # nfs This shell script starts and stops the nfs services in a distribution
4 ## description: starts and stops nfs client services
5 # chkconfig: 2345 99 01
7 # Copyright (c) 2000-2001 Mission Critical Linux, Inc.
10 PATH=/sbin:/bin:/usr/sbin:/usr/bin
14 SCRIPT_NAME=`basename $0`
16 # Grab our daemon functions.
17 . `dirname $0`/nfs-functions
19 # Kernel daemons and options
20 PREFIX="rpc." # Prefix for kernel execs (usually "rpc.")
23 # User daemons and options
24 STATD="rpc.statd" # NLM Server
27 # We need rpc.lockd on kernels < 2.2.18 if Trond Myklebust and Dave Higgens'
28 # NFS patches have not been applied.
31 if [ "`uname`" = "Linux" ]; then
35 # This messily chops up the linux version number and turns it into
36 # a comparable integer.
38 # printf value description
39 # %d `echo $os_rel | cut -f1 -d.` Major Linux release #
40 # %02d `echo $os_rel | cut -f2 -d.` Minor Linux release #
41 # %02d `echo $os_rel | cut -f3 -d.` Patchlevel
43 linux_version_code=`printf "%d%02d%02d" \`echo $os_rel | cut -f1 -d.\` \`echo $os_rel | cut -f2 -d.\` \`echo $os_rel | cut -f3 -d.\``
44 return $((linux_version_code < 20218))
47 # On non-Linux systems, assume that lockd is always required.
51 # We use "type -path" instead of "which" since it's internal to bash.
52 [ -x "`type -path $STATD`" ] || exit 0
54 # Check to see if we need lockd (ie, nfsd doesn't handle spawning and
60 # We need it. Make sure we have it.
61 [ -x "`type -path $PREFIX$LOCKD`" ] || exit 0
64 # Handle how we were called.
67 # Start rpc.statd daemon without options...
68 echo -n "Starting $STATD: "
73 echo -n "Starting $LOCKD: "
74 startdaemon $PREFIX$LOCKD
77 # if this lock file doesn't exist, init won't even try to run
78 # the shutdown script for this service on RedHat systems!
79 # on non-RedHat systems, /var/lock/subsys may not exist.
80 touch /var/lock/subsys/$SCRIPT_NAME &> /dev/null
84 echo -n "Stopping $STATD: "
87 if [ -n "$LOCKD" ]; then
88 echo -n "Stopping $LOCKD: "
92 rm -f /var/lock/subsys/$SCRIPT_NAME
103 if [ -n "$LOCKD" ]; then
111 echo "Usage: $0 {start|stop|status|restart}"