]> git.pld-linux.org Git - packages/corosync.git/blob - corosync-notifyd.init
ff08b48dc9b0888381f340ad2bc9061c3718b343
[packages/corosync.git] / corosync-notifyd.init
1 #!/bin/sh
2 #
3 # corosync-notifyd      Corosync Dbus and snmp notifier
4 #
5 # chkconfig: 2345 23 77
6 # description: Corosync Dbus and snmp notifier
7 # processname: corosync-notifyd-notifyd
8 #
9 ### BEGIN INIT INFO
10 # Provides:             corosync-notifyd-notifyd
11 # Required-Start:       $corosync-notifyd $cman
12 # Required-Stop:        $corosync-notifyd $cman
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
22 SEND_SNMP_TRAPS=no
23 SEND_DBUS_SIGNALS=yes
24 LOG_ALL_EVENTS=no
25
26 [ -f /etc/sysconfig/corosync-notifyd ] && . /etc/sysconfig/corosync-notifyd
27
28 start() {
29         # Check if the service is already running?
30         if [ -f /var/lock/subsys/corosync-notifyd ]; then
31                 msg_already_running "Corosync Notifier"
32                 return
33         fi
34         if [ -f /var/lock/subsys/openais ]; then
35                 msg_already_running "Corosync Notifier (as openais)"
36                 return
37         fi
38         if grep -q nocluster /proc/cmdline ; then
39                 show "Disabled on boot"
40                 RETVAL=1
41                 return
42         fi
43
44         local options=""
45         if is_yes "$SEND_SNMP_TRAPS" ; then
46                 options="$options -s"
47         fi
48         if [ -n "$SNMP_MANAGER" ] ; then
49                 options="$options -m $SNMP_MANAGER"
50         fi
51         if is_yes "$SEND_DBUS_SIGNALS" ; then
52                 options="$options -d"
53         fi
54         if is_yes "$LOG_ALL_EVENTS" ; then
55                 options="$options -l"
56         fi
57         msg_starting "Corosync Notifier"
58         daemon /usr/sbin/corosync-notifyd "$options"
59         RETVAL=$?
60         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/corosync-notifyd
61 }
62
63 stop() {
64         if [ ! -f /var/lock/subsys/corosync-notifyd ]; then
65                 msg_not_running "Corosync Notifier"
66                 return
67         fi
68
69         # Stop daemons.
70         msg_stopping "Corosync Notifier"
71         killproc /usr/sbin/corosync-notifyd
72         rm -f /var/lock/subsys/corosync-notifyd
73 }
74
75 condrestart() {
76         if [ ! -f /var/lock/subsys/corosync-notifyd ]; then
77                 msg_not_running "Corosync Notifier"
78                 RETVAL=$1
79                 return
80         fi
81
82         stop
83         start
84 }
85
86 case "$1" in
87   start)
88         start
89         ;;
90   stop)
91         stop
92         ;;
93   restart)
94         stop
95         sleep 5
96         start
97         ;;
98   try-restart)
99         condrestart 0
100         ;;
101   force-reload)
102         condrestart 7
103         ;;
104   status)
105         status corosync-notifyd
106         RETVAL=$?
107         ;;
108 *)
109         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
110         exit 3
111         ;;
112 esac
113 exit $RETVAL
This page took 0.060019 seconds and 2 git commands to generate.