Created
September 7, 2011 18:03
-
-
Save hgdeoro/1201273 to your computer and use it in GitHub Desktop.
Ejemplo de /etc/init.d/munin-node para CentOS 5.6
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 Start de Munin node | |
# | |
# chkconfig: 2345 55 25 | |
# description: Starts and stops the Munin node daemon | |
# | |
source /opt/munin/munin-node-settings | |
# +-> export PERL5LIB=/opt/perl-munin/lib/perl5/5.8.8:/opt/perl-munin/lib/perl5/site_perl/5.8.8:/opt/munin/usr/lib/perl5/site_perl/5.8.8 | |
# +-> export PATH=/opt/munin/bin:/opt/munin/sbin:$PATH | |
# +-> export MUNIN_PID_FILE=/opt/munin/var/run/munin/munin-node.pid | |
pgrep munin-node | grep MUNIN_PID_FILE | |
case "$1" in | |
"start") | |
if [ -e $MUNIN_PID_FILE ] ; then | |
echo "ATENCION: Ya existe archivo con pid: $MUNIN_PID_FILE... Igual se intentara iniciar el servidor." | |
fi | |
munin-node | |
exit 0 | |
;; | |
"stop") | |
if [ ! -e $MUNIN_PID_FILE ] ; then | |
echo "ERROR: No se encontro archivo con pid: $MUNIN_PID_FILE" | |
exit 1 | |
fi | |
pid=`cat $MUNIN_PID_FILE` | |
pgrep munin-node | grep -q $pid | |
if [ "$?" -ne 0 ] ; then | |
echo "ERROR: Se encontro archivo con pid: $MUNIN_PID_FILE, pero no se encontro proceso 'munin-node'" | |
exit 1 | |
fi | |
kill $pid | |
exit 0 | |
;; | |
*) | |
echo "Opcion no valida" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment