]> git.pld-linux.org Git - packages/pacemaker.git/blob - pacemaker.init
BR: heartbeat-devel >= 3.0.5-6
[packages/pacemaker.git] / pacemaker.init
1 #!/bin/sh
2 #
3 # pacemaker     Pacemaker Cluster Manager for the Corosync stack
4 #
5 # chkconfig: 2345 23 77
6 # description: Pacemaker Cluster Manager
7 # processname: pacemakerd
8 #
9 ### BEGIN INIT INFO
10 # Provides:             pacemaker
11 # Required-Start:       $corosync
12 # Required-Stop:        $corosync
13 # Default-Start:
14 # Default-Stop:
15 # Short-Description:    Starts and stops Pacemaker Cluster Manager.
16 # Description:          Starts and stops Pacemaker Cluster Manager.
17 ### END INIT INFO
18
19 # Source function library
20 . /etc/rc.d/init.d/functions
21
22 [ -f /etc/sysconfig/pacemaker ] && . /etc/sysconfig/pacemaker
23
24 start() {
25         # Check if the service is already running?
26         if [ -f /var/lock/subsys/pacemaker ]; then
27                 msg_already_running "Pacemaker Cluster Manager"
28                 return
29         fi
30         if grep -q nocluster /proc/cmdline ; then
31                 show "Disabled on boot"
32                 RETVAL=1
33                 return
34         fi
35
36         msg_starting "Pacemaker Cluster Manager"
37         daemon --fork --close-fds /usr/sbin/pacemakerd
38         RETVAL=$?
39         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pacemaker
40 }
41
42 stop() {
43         if [ ! -f /var/lock/subsys/pacemaker ]; then
44                 msg_not_running "Pacemaker Cluster Manager"
45                 return
46         fi
47
48         # Stop daemons.
49         msg_stopping "Pacemaker Cluster Manager"
50         killproc /usr/sbin/pacemakerd
51         rm -f /var/lock/subsys/pacemaker
52 }
53
54 condrestart() {
55         if [ ! -f /var/lock/subsys/pacemaker ]; then
56                 msg_not_running "Pacemaker Cluster Manager"
57                 RETVAL=$1
58                 return
59         fi
60
61         stop
62         start
63 }
64
65 case "$1" in
66   start)
67         start
68         ;;
69   stop)
70         stop
71         ;;
72   restart)
73         stop
74         sleep 5
75         start
76         ;;
77   try-restart)
78         condrestart 0
79         ;;
80   force-reload)
81         condrestart 7
82         ;;
83   status)
84         status pacemaker pacemakerd
85         RETVAL=$?
86         ;;
87 *)
88         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
89         exit 3
90         ;;
91 esac
92 exit $RETVAL
This page took 0.085493 seconds and 3 git commands to generate.