summaryrefslogtreecommitdiffstats
path: root/etc/nodist
diff options
context:
space:
mode:
authorlon <lon>2001-02-09 18:58:07 +0000
committerlon <lon>2001-02-09 18:58:07 +0000
commit3c70715e64085e92ced46801ee47ac5c36d061d9 (patch)
tree6f0ea1cfbfb5cbe5f3f546914c74ac434eed109c /etc/nodist
parent7e1b3be8a387f0855f7a5d88ab27995aba2ab29a (diff)
downloadnfs-utils-3c70715e64085e92ced46801ee47ac5c36d061d9.tar.gz
nfs-utils-3c70715e64085e92ced46801ee47ac5c36d061d9.tar.xz
nfs-utils-3c70715e64085e92ced46801ee47ac5c36d061d9.zip
Initial script for distribution-independent SysV init script to start
nfs server services (nfsd, mountd, rquotad).
Diffstat (limited to 'etc/nodist')
-rwxr-xr-xetc/nodist/nfs-server114
1 files changed, 114 insertions, 0 deletions
diff --git a/etc/nodist/nfs-server b/etc/nodist/nfs-server
new file mode 100755
index 0000000..d95eada
--- /dev/null
+++ b/etc/nodist/nfs-server
@@ -0,0 +1,114 @@
+#!/bin/sh
+# nfs This shell script starts and stops the nfs services in a distribution
+# independent fashion.
+#
+# description: starts and stops nfs server 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.")
+NFSD="nfsd" # Kernel NFS Server
+RPCNFSDCOUNT="8" # Number of nfsd threads
+
+# User daemons and options
+RQUOTAD="rpc.rquotad" # Remote quota server
+MOUNTD="rpc.mountd" # Mount server
+RPCMOUNTDOPTS="" # options for rpc.mountd
+EXPORTFS="exportfs" # Exportfs command
+
+SCRIPT_NAME=`basename $0`
+DESC="NFS kernel daemon"
+
+# We use "type -path" instead of "which" since it's internal to bash.
+[ -x "`type -path $PREFIX$NFSD`" ] || exit 0
+[ -x "`type -path $MOUNTD`" ] || exit 0
+
+# Also make sure we have our exportfs command.
+[ -x "`type -path $EXPORTFS`" ] || exit 0
+[ -s /etc/exports ] || exit 0
+
+# rquotad is not required for NFS to work, however.
+# Unset if it is not present.
+[ -x "`type -path $RQUOTAD`" ] || unset RQUOTAD
+
+# Handle how we were called.
+case "$1" in
+start)
+ echo -n "Exporting directories for $DESC..."
+ $EXPORTFS -r
+ echo "done."
+
+ if /usr/sbin/rpcinfo -u localhost nfs 3 &>/dev/null
+ then
+ RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-nfs-version 3"
+ fi
+
+ # Start rquotad if it is set
+ if [ -n "$RQUOTAD" ]
+ then
+ echo -n "Starting $RQUOTAD: "
+ startdaemon $RQUOTAD
+ fi
+
+ echo -n "Starting $MOUNTD: "
+ startdaemon $MOUNTD $RPCMOUNTDOPTS
+ echo -n "Starting $NFSD: "
+ startdaemon $PREFIX$NFSD $RPCNFSDCOUNT
+
+ # 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)
+ for process in $RQUOTAD $MOUNTD $NFSD
+ do
+ echo -n "Stopping $process: "
+ stopdaemon $process
+ done
+
+ echo "Unexporting directories for $DESC..."
+ $EXPORTFS -au
+ rm -f /var/lock/subsys/$SCRIPT_NAME
+ echo "done."
+ ;;
+
+restart)
+ $0 stop
+ $0 start
+ ;;
+
+reload)
+ # Update exports
+ echo "Re-exporting directories for $DESC..."
+ $EXPORTFS -r
+ touch /var/lock/subsys/$SCRIPT_NAME &> /dev/null
+ echo "done."
+ ;;
+
+status)
+ # First, check status of userland daemons
+ for process in $RQUOTAD $MOUNTD $NFSD
+ do
+ daemonstatus $process
+ done
+ exit 0
+ ;;
+
+*)
+ echo "Usage: $0 {start|stop|status|restart|reload}"
+ exit 1
+esac