]> git.pld-linux.org Git - packages/corosync.git/blob - corosync-notifyd.init
make sysconfig/corosync-notifyd usable for systemd
[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 OPTIONS="-d"
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 grep -q nocluster /proc/cmdline ; then
33                 show "Disabled on boot"
34                 RETVAL=1
35                 return
36         fi
37
38         msg_starting "Corosync Notifier"
39         daemon /usr/sbin/corosync-notifyd "$OPTIONS"
40         RETVAL=$?
41         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/corosync-notifyd
42 }
43
44 stop() {
45         if [ ! -f /var/lock/subsys/corosync-notifyd ]; then
46                 msg_not_running "Corosync Notifier"
47                 return
48         fi
49
50         # Stop daemons.
51         msg_stopping "Corosync Notifier"
52         killproc /usr/sbin/corosync-notifyd
53         rm -f /var/lock/subsys/corosync-notifyd
54 }
55
56 condrestart() {
57         if [ ! -f /var/lock/subsys/corosync-notifyd ]; then
58                 msg_not_running "Corosync Notifier"
59                 RETVAL=$1
60                 return
61         fi
62
63         stop
64         start
65 }
66
67 case "$1" in
68   start)
69         start
70         ;;
71   stop)
72         stop
73         ;;
74   restart)
75         stop
76         sleep 5
77         start
78         ;;
79   try-restart)
80         condrestart 0
81         ;;
82   force-reload)
83         condrestart 7
84         ;;
85   status)
86         status corosync-notifyd
87         RETVAL=$?
88         ;;
89 *)
90         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
91         exit 3
92         ;;
93 esac
94 exit $RETVAL
This page took 0.052738 seconds and 3 git commands to generate.