]> git.pld-linux.org Git - packages/nfs-utils.git/blame_incremental - nfslock.init
- merged from AC-branch
[packages/nfs-utils.git] / nfslock.init
... / ...
CommitLineData
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 is_yes "${NETWORKING}"; then
23 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
24 msg_network_down "NFS lockd"
25 exit 1
26 fi
27else
28 exit 0
29fi
30
31if [ -x /sbin/pidof ] && [ "$1" != "stop" ]; then
32 [ -z "`/sbin/pidof portmap`" ] && nls "Error: portmap isn't running" && exit 0
33fi
34
35# Sanity checks
36[ -x /usr/sbin/rpc.statd ] || exit 0
37
38RETVAL=0
39# See how we were called.
40case "$1" in
41 start)
42 # Check if the service is already running?
43 if [ ! -f /var/lock/subsys/nfslock ]; then
44 # Start daemons.
45 msg_starting "NFS statd"
46 daemon rpc.statd $STATDOPTS
47 RETVAL=$?
48 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nfslock
49 else
50 msg_already_running "NFS statd"
51 fi
52 ;;
53 stop)
54 if [ -f /var/lock/subsys/nfslock ]; then
55 # Stop daemons.
56 msg_stopping "NFS statd"
57 killproc rpc.statd
58 rm -f /var/lock/subsys/nfslock
59 else
60 msg_not_running "NFS statd"
61 fi
62 ;;
63 status)
64 status rpc.statd
65 exit $?
66 ;;
67 restart|force-reload)
68 $0 stop
69 $0 start
70 exit $?
71 ;;
72 probe)
73 if [ ! -f /var/lock/subsys/nfslock ]; then
74 echo start
75 exit 0
76 fi
77 /sbin/pidof rpc.statd >/dev/null 2>&1; STATD="$?"
78 if [ $STATD = 1 ]; then
79 echo restart
80 exit 0
81 fi
82 ;;
83 *)
84 msg_usage "$0 {start|stop|restart|force-reload|probe|status}"
85 exit 3
86esac
87
88exit $RETVAL
This page took 0.029455 seconds and 4 git commands to generate.