#!/bin/sh
#
# /etc/init.d/munin-asyncd
#
# chkconfig: - 91 9
# description: Network-wide resource monitoring tool (async proxy)
# processname: munin-asyncd
#
### BEGIN INIT INFO
# Provides: munin-asyncd
# Required-Start: $network $syslog
# Required-Stop:
# Default-Stop: 0 1 2 6
# Short-Description: Network-wide resource monitoring tool (async proxy)
# Description: Munin is a highly flexible and powerful solution used to create
# graphs of virtually everything imaginable throughout your network,
# while still maintaining a rattling ease of installation and
# configuration.
### END INIT INFO
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
# Read config
ASYNCD=yes
[ -f /etc/sysconfig/munin-node ] && . /etc/sysconfig/munin-node
progasync=munin-asyncd
binasync=/usr/sbin/$progasync
RETVAL=0
start() {
echo -n $"Starting $progasync: "
mkdir -p /var/run/munin 2>/dev/null
chown munin:munin /var/run/munin
restorecon /var/run/munin 2>/dev/null
${binasync} < /dev/null > /dev/null 2>&1 &
sleep 1
pkill -0 $progasync
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo_success
touch /var/lock/subsys/$progasync
else
echo_failure
fi
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $progasync: "
killproc ${binasync}
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/$progasync
return $RETVAL
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart)
[ -f /var/lock/subsys/$progasync ] && restart
;;
status)
status ${binasync}
RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|restart|condrestart|status}"
RETVAL=2
esac
exit $RETVAL