[mrtg] Re: Kill Daemon

Scott Schappell archon at silvertree.org
Mon Oct 27 15:24:52 MET 2003


Muhammed Ali wrote:

>Hello friends,
> 
>
>How can I stop my mrtg which is working on Linux-9.0  as Daemon, because
>some times I need to change my config file and need to restart, can any one
>help me ??
>
> 
>
> 
>
>Regards
>
>Muhammed Ali
>
>
>
>--
>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
>
>  
>
I've found since upgrading to 2.10.5 the kill <pid> just causes it to 
reset itself after 10 seconds, it's something I wrote to the list about 
earlier, but haven't seen a reply. I just send it a -9 to completely 
kill it.  kill -9 mrtg.pid  will do the trick for you..  However, if all 
you're doing is a reload of the config, if you send it a kill mrtg.pid 
that should (at least it does on FreeBSD 4.8) do a reload after 10 seconds.

Here's the script I use to control MRTG, you may want to modify it to 
suit your environment:

#! /bin/sh
case "$1" in
        start)
                if [ -f /usr/local/etc/mrtg/mrtg.pid ]
                then
                echo "MRTG already running"
                else
                cd /usr/local/bin && ./mrtg --user=apache --group=webdev \
                /usr/local/etc/mrtg/mrtg.cfg  --logging \
                /usr/local/etc/mrtg/logs/mrtg.log
                fi
                ;;
        stop)
                if [ -f /usr/local/etc/mrtg/mrtg.pid ]
                then
                kill -9 `cat /usr/local/etc/mrtg/mrtg.pid`
                rm /usr/local/etc/mrtg/mrtg.pid
                echo "MRTG stopped."
                else
                echo "MRTG is not running, no such PID file."
                fi
                ;;
        restart)
                if [ -f /usr/local/etc/mrtg/mrtg.pid ]
                then
                kill -9 `cat /usr/local/etc/mrtg/mrtg.pid`
                rm /usr/local/etc/mrtg/mrtg.pid
                fi
                cd /usr/local/bin && ./mrtg --user=apache --group=webdev \
                /usr/local/etc/mrtg/mrtg.cfg  --logging \
                /usr/local/etc/mrtg/logs/mrtg.log
                echo "MRTG restarted."
                ;;
        *)
                echo "Usage: mrtg.sh start|stop|restart"
                ;;

esac

Cheers and HTH

--
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