nfs-utils/nfslock.init
cvsdist 7a8b6562b5 auto-import changelog data from nfs-utils-0.3.1-11.src.rpm
Fri Jul 13 2001 Bob Matthews <bmatthews@redhat.com>
- Make %pre useradd consistent with other Red Hat packages.
Tue Jul 03 2001 Michael K. Johnson <johnsonm@redhat.com>
- Added sh-utils dependency for uname -r in nfs init script
Tue Jun 12 2001 Bob Matthews <bmatthews@redhat.com>
- make non RH kernel release strings scan correctly in
- nfslock init script (#44186)
Mon Jun 11 2001 Bob Matthews <bmatthews@redhat.com>
- don't install any rquota pages in _mandir: (#39707, #44119)
- don't try to manipulate rpc.rquotad in init scripts
- unless said program actually exists: (#43340)
2004-09-09 09:16:23 +00:00

115 lines
2.3 KiB
Bash
Executable File

#!/bin/sh
#
# nfslock This shell script takes care of starting and stopping
# the NFS file locking service.
#
# chkconfig: 345 14 86
# description: NFS is a popular protocol for file sharing across \
# TCP/IP networks. This service provides NFS file \
# locking functionality.
# probe: true
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
if [ ! -f /etc/sysconfig/network ]; then
exit 0
fi
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
# Start lockd from userland only if kernel <= 2.2.18
OS_RELEASE=`uname --release`
OS_RELEASE_MAJOR=`echo "$OS_RELEASE" | sed 's/\(^[0-9]\)\..*/\1/'`
OS_RELEASE_MINOR=`echo "$OS_RELEASE" | sed 's/\(^[0-9]\)\.\([0-9]*\)\..*/\2/'`
OS_RELEASE_VERSION=`echo "$OS_RELEASE" | sed 's/\(^[0-9]\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
if [ "$OS_RELEASE_MAJOR" -le 2 -a "$OS_RELEASE_MINOR" -le 2 -a "$OS_RELEASE_VERSION" -le 18 ] ; then
USERLAND_LOCKD="yes"
else
USERLAND_LOCKD=
fi
if [ "$USERLAND_LOCKD" ] ; then
[ -x /sbin/rpc.lockd ] || exit 0
fi
[ -x /sbin/rpc.statd ] || exit 0
RETVAL=0
start() {
# Start daemons.
echo "Starting NFS file locking services: "
if [ "$USERLAND_LOCKD" ]; then
echo -n "Starting NFS lockd: "
daemon rpc.lockd
echo
fi
echo -n "Starting NFS statd: "
daemon rpc.statd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/nfslock
return $RETVAL
}
stop() {
# Stop daemons.
echo "Shutting down NFS file locking services: "
if [ "$USERLAND_LOCKD" ]; then
echo -n "Shutting down NFS lockd: "
killproc lockd
echo
fi
echo -n "Shutting down NFS statd: "
killproc rpc.statd
RETVAL=0
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/nfslock
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
if [ "$USERLAND_LOCKD" ]; then
status lockd
fi
status rpc.statd
;;
restart)
stop
start
;;
probe)
if [ ! -f /var/lock/subsys/nfslock ] ; then
echo start; exit 0
fi
/sbin/pidof rpc.statd >/dev/null 2>&1; STATD="$?"
if [ "$USERLAND_LOCKD" ]; then
/sbin/pidof lockd >/dev/null 2>&1; LOCKD="$?"
else
LOCKD=0
fi
if [ $STATD = 1 -o $LOCKD = 1 ] ; then
echo restart; exit 0
fi
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
esac
exit 0