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