[mrtg] Re: UNIX/Linux startup script, anyone??

Ivette Reategui reategi at mail.nlm.nih.gov
Thu Mar 14 14:11:52 MET 2002


This is what I use:

#!/sbin/sh
#

MRTG_HOME=/home/mrtg
CONF_FILE=/home/mrtg/bin/mrtg.cfg

if [ ! -f ${CONF_FILE} ]; then
        echo "no mrtg configuration file!"
        exit 0
fi

case "$1" in
start)
        echo "mrtg starting."
        ${MRTG_HOME}/bin/mrtg ${CONF_FILE} > ${MRTG_HOME}/log 2>&1
        ;;
stop)
        echo "mrtg stopping."
        pkill -x -u 0 mrtg
        ;;
*)
        echo "Usage: $0 {start|stop}"
        exit 1
        ;;
esac

exit 0



>>> "Michael Marziani" <michaelm at kw.com> 03/13/02 02:30PM >>>

When running MRTG as a daemon, it creates a pid file that would normally
be deleted when MRTG shuts down via a TERM signal.  Problem is, somehow
when the system is rebooted, MRTG is getting killed improperly, so the
PIDfile remains and MRTG won't restart when the system reboots.  My
current init script is:

--------------------------------------
#! /bin/sh

cd /usr/local/mrtg/bin && ./mrtg --user=mrtg \
      /usr/local/mrtg/cfg/mrtg.cfg  --logging /var/log/mrtg.log &
--------------------------------------

Has anyone written a script that can actually handle the "start",
"stop", "restart" commands?  This would solve my problem as it would
successfully send a "stop" when shutting down and mrtg would shutdown
properly and remove it's pid file.

If no one has written such a script, I'd be more than happy to write one
and share it, but I'd rather not spend the time if someone already has
done this.  Thanks!!!

-Mike

_____________________________
Michael D. Marziani
Systems Administrator

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe 
Archive     http://www.ee.ethz.ch/~slist/mrtg 
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org 
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi 



--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list