]> git.pld-linux.org Git - packages/nfs-utils.git/blame - nfslock.init
- unified versions for nfs-server, knfsd and nfs-utils
[packages/nfs-utils.git] / nfslock.init
CommitLineData
d419f9f1
JR
1#!/bin/sh
2#
3# nfslock This shell script takes care of starting and stopping
4# the NFS file locking service.
5#
6# chkconfig: 345 61 19
7# description: NFS is a popular protocol for file sharing across \
8# TCP/IP networks. This service provides NFS file \
9# locking functionality.
10# probe: true
11
12# Source function library.
13. /etc/rc.d/init.d/functions
14
15# Get network config
16. /etc/sysconfig/network
17
18# Get service config
19[ -f /etc/sysconfig/nfslock ] && . /etc/sysconfig/nfslock
20
21# Check that networking is up.
22if [ "${NETWORKING}" = "no" ]; then
23 echo "WARNING: Networking is down. NFS lockd and statd can't be run"
24 exit 1
25fi
26
27if [ -x /sbin/pidof ] && [ "$1" != "stop" ]; then
28 [ -z "`/sbin/pidof portmap`" ] && echo "Error: portmap isn't running" && exit 0
29fi
30
31# Sanity checks
32[ -x /usr/sbin/rpc.lockd ] || exit 0
33[ -x /usr/sbin/rpc.statd ] || exit 0
34
35# See how we were called.
36case "$1" in
37 start)
38 # Start daemons.
39 show "Starting NFS lockd"
40 daemon rpc.lockd
41 show "Starting NFS statd"
42 daemon rpc.statd
43 touch /var/lock/subsys/nfslock
44 ;;
45 stop)
46 # Stop daemons.
47 show "Shutting down NFS lockd"
48 killproc lockd
49 show "Shutting down NFS statd"
50 killproc rpc.statd
51 rm -f /var/lock/subsys/nfslock
52 ;;
53 status)
54 status lockd
55 status rpc.statd
56 ;;
57 restart)
58 $0 stop
59 $0 start
60 ;;
61 probe)
62 if [ ! -f /var/lock/subsys/nfslock ] ; then
63 echo start; exit 0
64 fi
65 /sbin/pidof rpc.statd >/dev/null 2>&1; STATD="$?"
66 /sbin/pidof lockd >/dev/null 2>&1; LOCKD="$?"
67 if [ $STATD = 1 -o $LOCKD = 1 ] ; then
68 echo restart; exit 0
69 fi
70 ;;
71 *)
72 echo "Usage: nfslock {start|stop|status|restart}"
73 exit 1
74esac
75
76exit 0
This page took 0.050435 seconds and 4 git commands to generate.