Created
June 9, 2014 06:49
-
-
Save zembutsu/2f015ae1999303a23a92 to your computer and use it in GitHub Desktop.
An init script for Munin 2.1.x that is installed to /opt/munin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# | |
# munin-node Control the Munin Node Server (formerly Linpro RRD client) | |
# | |
# chkconfig: 2345 90 10 | |
# description: munin node agents | |
# processname: munin-node | |
# config: /etc/opt/munin/munin-node.conf | |
# pidfile: /var/run/munin/munin-node.pid | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
RETVAL=0 | |
PROCNAME=munin-node | |
mkdir -p /var/run/munin 2>/dev/null | |
chown munin /var/run/munin | |
restorecon /var/run/munin 2>/dev/null | |
# See how we were called. | |
case "$1" in | |
start) | |
echo -n "Starting Munin Node: " | |
/opt/munin/sbin/munin-node & | |
sleep 1 | |
pkill -0 $PROCNAME | |
RETVAL=$? | |
if [ $RETVAL -eq 0 ] | |
then | |
echo_success | |
touch /var/lock/subsys/munin-node | |
else | |
echo_failure | |
fi | |
echo | |
;; | |
stop) | |
echo -n "Stopping Munin Node agents: " | |
kill $(cat /var/run/munin/munin-node.pid) | |
RETVAL=$? | |
if [ $RETVAL -eq 0 ] | |
then | |
echo_success | |
rm -f /var/lock/subsys/munin-node | |
else | |
echo_failure | |
fi | |
echo | |
;; | |
status) | |
status $PROCNAME | |
RETVAL=$? | |
;; | |
restart|reload) | |
$0 stop | |
$0 start | |
RETVAL=$? | |
;; | |
*) | |
echo "Usage: munin-node {start|stop|status|restart}" | |
exit 1 | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chkconfig --add munin-node
chkconfig munin-node on
service munin-node start