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