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