3 # munin-asyncd Start/Stop the munin-asyncd daemon.
5 # chkconfig: 2345 91 09
6 # description: munin-asyncd enables asyncronous fetching of
7 # metrics from munin-node in a Munin monitoring setup.
9 # processname: munin-asyncd
10 # pidfile: /var/run/munin-asyncd.pid
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
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.
23 # Source function library.
24 . /etc/rc.d/init.d/functions
27 . /etc/sysconfig/munin-asyncd
29 # Set defaults in case they're not defined in config
30 MUNIN_NODE_HOST=${MUNIN_NODE_HOST:-localhost}
31 MUNIN_NODE_PORT=${MUNIN_NODE_HOST:-4949}
32 MUNIN_ASYNCD_SHUTDOWN_TIMEOUT=${MUNIN_ASYNCD_SHUTDOWN_TIMEOUT:-15}
35 # Check if the service is already running?
36 if [ -f /var/lock/subsys/munin-asyncd ]; then
37 msg_already_running "Munin Asyncd"
41 msg_starting "Munin Asyncd"
42 daemon --fork /usr/sbin/munin-asyncd --host ${MUNIN_NODE_HOST}:${MUNIN_NODE_PORT}
44 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/munin-asyncd
48 if [ ! -f /var/lock/subsys/munin-asyncd ]; then
49 msg_not_running "Munin Asyncd"
53 msg_stopping "Munin Asyncd"
55 # We can't kill by process name, asyncd is changing it dynamically
56 # so we simply send TERM to all asyncd processes
57 for ppid in $(pgrep "^munin-asyncd "); do
61 while pgrep "^munin-asyncd " 1>/dev/null 2>&1; do
62 # If timeout was reached send kill signal and break loop
63 if [ $timeout -ge $MUNIN_ASYNCD_SHUTDOWN_TIMEOUT ]; then
64 for ppid in $(pgrep "^munin-asyncd "); do
70 timeout=$((timeout+1))
73 rm -f /var/lock/subsys/munin-asyncd
77 if [ ! -f /var/lock/subsys/munin-asyncd ]; then
78 msg_not_running "Munin Asyncd"
88 # See how we were called.
96 restart|reload|force-reload)
104 status --pidfile /var/run/munin-asyncd.pid munin-asyncd
108 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"