- merged 4.0.7 from PLD
[packages/dlm.git] / dlm.init
1 #!/bin/sh
2 #
3 # dlm_controld
4 #
5 # chkconfig: 345 22 78
6 # description: starts and stops dlm_controld
7 #
8
9 . /etc/rc.d/init.d/functions
10
11 DLM_CONTROLD_OPTS=""
12
13 [ -f /etc/sysconfig/dlm ] && . /etc/sysconfig/dlm
14
15 setup() {
16         /sbin/modprobe -q dlm
17         mount -t configfs none /sys/kernel/config > /dev/null 2>&1
18 }
19
20 start() {
21
22         # Check if the service is already running?
23         if [ -f /var/lock/subsys/dlm ]; then
24                 msg_already_running "dlm_controld"
25                 return
26         fi
27
28         setup
29
30         msg_starting "dlm_controld"
31
32         daemon /usr/sbin/dlm_controld $DLM_CONTROLD_OPTS
33         RETVAL=$?
34         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dlm
35 }
36
37 stop() {
38         if [ ! -f /var/lock/subsys/dlm ]; then
39                 msg_not_running "dlm_controld"
40                 return
41         fi
42
43         msg_stopping "dlm_controld"
44         killproc dlm_controld
45         rm -f /var/lock/subsys/dlm
46 }
47
48 condrestart() {
49         if [ ! -f /var/lock/subsys/dlm ]; then
50                 msg_not_running "dlm_controld"
51                 RETVAL=$1
52                 return
53         fi
54
55         stop
56         start
57 }
58
59 # See how we were called.
60 case "$1" in
61   start)
62         start
63         ;;
64   stop)
65         stop
66         ;;
67   restart)
68         stop
69         start
70         ;;
71   try-restart)
72         condrestart 0
73         ;;
74   force-reload)
75         condrestart 0
76         ;;
77   status)
78         status --pidfile /var/run/dlm/dlm_controld.pid dlm dlm_controld
79         exit $?
80         ;;
81   *)
82         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
83         exit 3
84 esac
85 exit $RETVAL