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

Naresh Cherukuri naresh at cityonlines.com
Thu Mar 14 07:02:26 MET 2002


hello ,

This is the script I am using  and working fine. 

#!/bin/sh
# description: Cisco router Mrtg

case "$1" in
'start')
# delete Pid file
 rm /var/www/html/mrtg/cisco/cisco.pid

# start Mrtg perl <mrtgpath> <cfg file path>
  perl /usr/bin/mrtg /var/www/html/mrtg/cisco/cisco.cfg
 touch /var/lock/subsys/Cisco2mrtg
 ;;
'stop')
 rm /var/www/html/mrtg/cisco/cisco.pid
 rm -f /var/lock/subsys/Cisco2mrtg
 ;;
*)
 echo "Usage: $0 { start | stop }"
 ;;
esac
exit 0

----- Original Message ----- 
From: "Michael Marziani" <michaelm at kw.com>
To: <mrtg at list.ee.ethz.ch>
Sent: Thursday, March 14, 2002 1:00 AM
Subject: [mrtg] UNIX/Linux startup script, anyone??


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