- make it work with current munin version
[packages/munin.git] / munin-asyncd.init
1 #!/bin/sh
2 #
3 # munin-asyncd  Start/Stop the munin-asyncd daemon.
4 #
5 # chkconfig:    2345 91 09
6 # description:  munin-asyncd enables asyncronous fetching of
7 #               metrics from munin-node in a Munin monitoring setup.
8 #
9 # processname:  munin-asyncd
10 # pidfile:      /var/run/munin-asyncd.pid
11 #
12 ### BEGIN INIT INFO
13 # Provides:             munin-asyncd
14 # Required-Start:       $local_fs $remote_fs $network
15 # Required-Stop:        $local_fs $remote_fs $network
16 # Default-Start:        2 3 4 5
17 # Default-Stop:         0 1 6
18 # Short-Description:    Starts and stops munin-asyncd
19 # Description:          munin-asyncd enables asyncronous fetching of
20 #                       metrics from munin-node in a Munin monitoring setup.
21 ### END INIT INFO
22
23 # Source function library.
24 . /etc/rc.d/init.d/functions
25
26 start() {
27         # Check if the service is already running?
28         if [ -f /var/lock/subsys/munin-asyncd ]; then
29                 msg_already_running "munin-asyncd"
30                 return
31         fi
32
33         msg_starting "munin-asyncd"
34         daemon /usr/sbin/munin-asyncd
35         RETVAL=$?
36         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/munin-asyncd
37 }
38
39 stop() {
40         if [ ! -f /var/lock/subsys/munin-asyncd ]; then
41                 msg_not_running "munin-asyncd"
42                 return
43         fi
44
45         msg_stopping "munin-asyncd"
46         killproc munin-asyncd
47         rm -f /var/lock/subsys/munin-asyncd
48 }
49
50 condrestart() {
51         if [ ! -f /var/lock/subsys/munin-asyncd ]; then
52                 msg_not_running "munin-asyncd"
53                 RETVAL=$1
54                 return
55         fi
56
57         stop
58         start
59 }
60
61 RETVAL=0
62 # See how we were called.
63 case "$1" in
64   start)
65         start
66         ;;
67   stop)
68         stop
69         ;;
70   restart|reload|force-reload)
71         stop
72         start
73         ;;
74   try-restart)
75         condrestart 0
76         ;;
77   status)
78         status --pidfile /var/run/munin-asyncd.pid munin-asyncd
79         exit $?
80         ;;
81   *)
82         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
83         exit 3
84 esac
85
86 exit $RETVAL