summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlon <lon>2001-02-09 18:57:27 +0000
committerlon <lon>2001-02-09 18:57:27 +0000
commit7e1b3be8a387f0855f7a5d88ab27995aba2ab29a (patch)
tree22cedba1bb044f8af9ecc4a576efc30076555d1f
parent23473f0495f2f196b3e9d8282d05950483124f9f (diff)
downloadnfs-utils-7e1b3be8a387f0855f7a5d88ab27995aba2ab29a.tar.gz
nfs-utils-7e1b3be8a387f0855f7a5d88ab27995aba2ab29a.tar.xz
nfs-utils-7e1b3be8a387f0855f7a5d88ab27995aba2ab29a.zip
Initial script for nfs client (lockd/statd)
-rwxr-xr-xetc/nodist/nfs-client115
1 files changed, 115 insertions, 0 deletions
diff --git a/etc/nodist/nfs-client b/etc/nodist/nfs-client
new file mode 100755
index 0000000..4c0fa41
--- /dev/null
+++ b/etc/nodist/nfs-client
@@ -0,0 +1,115 @@
+#!/bin/sh
+# nfs This shell script starts and stops the nfs services in a distribution
+# independent fashion.
+## description: starts and stops nfs client services
+# chkconfig: 2345 99 01
+#
+# Copyright (c) 2000-2001 Mission Critical Linux, Inc.
+#
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+export PATH
+
+# Who am I?
+SCRIPT_NAME=`basename $0`
+
+# Grab our daemon functions.
+. `dirname $0`/nfs-functions
+
+# Kernel daemons and options
+PREFIX="rpc." # Prefix for kernel execs (usually "rpc.")
+LOCKD="lockd" # Lockd
+
+# User daemons and options
+STATD="rpc.statd" # NLM Server
+
+
+# We need rpc.lockd on kernels < 2.2.18 if Trond Myklebust and Dave Higgens'
+# NFS patches have not been applied.
+lockd_not_needed()
+{
+ if [ "`uname`" = "Linux" ]; then
+
+ os_rel=`uname -r`
+
+ # This messily chops up the linux version number and turns it into
+ # a comparable integer.
+ #
+ # printf value description
+ # %d `echo $os_rel | cut -f1 -d.` Major Linux release #
+ # %02d `echo $os_rel | cut -f2 -d.` Minor Linux release #
+ # %02d `echo $os_rel | cut -f3 -d.` Patchlevel
+ #
+ 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.\``
+ return $((linux_version_code < 20218))
+ fi
+
+ # On non-Linux systems, assume that lockd is always required.
+ return 1
+}
+
+# We use "type -path" instead of "which" since it's internal to bash.
+[ -x "`type -path $STATD`" ] || exit 0
+
+# Check to see if we need lockd (ie, nfsd doesn't handle spawning and
+# maintaining it)
+if lockd_not_needed
+then
+ unset LOCKD
+else
+ # We need it. Make sure we have it.
+ [ -x "`type -path $PREFIX$LOCKD`" ] || exit 0
+fi
+
+# Handle how we were called.
+case "$1" in
+start)
+ # Start rpc.statd daemon without options...
+ echo -n "Starting $STATD: "
+ startdaemon $STATD
+
+ if [ -n "$LOCKD" ]
+ then
+ echo -n "Starting $LOCKD: "
+ startdaemon $PREFIX$LOCKD
+ fi
+
+ # if this lock file doesn't exist, init won't even try to run
+ # the shutdown script for this service on RedHat systems!
+ # on non-RedHat systems, /var/lock/subsys may not exist.
+ touch /var/lock/subsys/$SCRIPT_NAME &> /dev/null
+ ;;
+
+stop)
+ echo -n "Stopping $STATD: "
+ stopdaemon $STATD
+
+ if [ -n "$LOCKD" ]; then
+ echo -n "Stopping $LOCKD: "
+ stopdaemon $LOCKD
+ fi
+
+ rm -f /var/lock/subsys/$SCRIPT_NAME
+ ;;
+
+restart)
+ $0 stop
+ $0 start
+ ;;
+
+status)
+ daemonstatus $STATD
+
+ if [ -n "$LOCKD" ]; then
+ daemonstatus $LOCKD
+ fi
+
+ exit 0
+ ;;
+
+*)
+ echo "Usage: $0 {start|stop|status|restart}"
+ exit 1
+esac
+
+exit 0