<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16525" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff size=2>This
may help get you started. Put all your configs in one directory and the
place this code in your startup script. Edit it to meet your
needs. </FONT></SPAN></DIV>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff size=2>I have
NOT tested this code. Use at your risk.</FONT></SPAN></DIV>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff
size=2>************ Start of Code ********************</FONT></SPAN></DIV>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff
size=2>CONFIG_DIR = "/etc/mrtg/configs"</FONT></SPAN></DIV>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff
size=2>start() <BR>{ <BR> echo -n $"Enabling MRTG:
"<BR> rm -f ${LOCKFILE} 2>
/dev/null</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff
size=2> cd CONFIG_DIR</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff
size=2> for i in `ls`<BR>
do<BR> env LANG=C ${MRTG}
--pid-file=${PIDFILE} --lock-file=${LOCKFILE} ${OPTIONS}
${i}<BR> done<BR>}</FONT></SPAN></DIV>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff size=2>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff
size=2>************ End of Code
********************</FONT></SPAN></DIV></FONT></SPAN></DIV>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff
size=2>Larry</FONT></SPAN></DIV>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=269370214-23082007><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B>
mrtg-bounces@lists.oetiker.ch [mailto:mrtg-bounces@lists.oetiker.ch] <B>On
Behalf Of </B>Brad Lodgen<BR><B>Sent:</B> Wednesday, August 22, 2007
16:56<BR><B>To:</B> mrtg@lists.oetiker.ch<BR><B>Subject:</B> [mrtg] MRTG
Daemon at Startup with hundreds of configs<BR><BR></FONT></DIV>Hi
there,<BR><BR>I'm looking at a project to switch a server that is using MRTG
to monitor hundreds of devices over to running MRTG in daemon mode, for
efficiency. As one could infer, there are hundreds of config files to go along
with those hundreds of devices. Since MRTG has to be started once for each
config, I'm trying to develop a Linux startup script that will execute all of
the configs. I will copy/paste the startup script I'm currently working with.
Does anyone have any idea how to change this to make it start up all of the
configs? It may be an easy answer, but I'm very fresh on shell scripting and
have spent hours searching for this info, to no avail. Please help!
<BR><BR>Thanks in advance for any advice or help you may provide...here is the
startup script I found....<BR><BR><BR><PRE class=alt2 dir=ltr style="BORDER-RIGHT: 1px inset; PADDING-RIGHT: 6px; BORDER-TOP: 1px inset; PADDING-LEFT: 6px; PADDING-BOTTOM: 6px; MARGIN: 0px; OVERFLOW: auto; BORDER-LEFT: 1px inset; WIDTH: 640px; PADDING-TOP: 6px; BORDER-BOTTOM: 1px inset; HEIGHT: 498px; TEXT-ALIGN: left">#!/bin/bash<BR>#<BR># mrtg This shell script starts mrtg<BR>#<BR># Author: Stefan SF <BR>#<BR># chkconfig: 345 90 35<BR>#<BR># description: mrtg The Multi Router Traffic Grapher<BR># processname: mrtg<BR>
# config: /etc/mrtg/mrtg.conf<BR>#<BR>### BEGIN INIT INFO<BR># Provides: mrtg<BR># Required-Start: $network<BR># Default-Stop: 0 1 6<BR># Short-Description: Starts the The Multi Router Traffic Grapher<BR># Description: The Multi Router Traffic Grapher (MRTG) is a tool to monitor \
<BR># the traffic load on network-links. MRTG generates HTML pages \<BR># containing GIF/PNG images which provide a live visual \<BR># representation of this traffic.<BR>### END INIT INFO
<BR><BR># source function library<BR>. /etc/rc.d/init.d/functions<BR><BR>MRTG="/usr/bin/mrtg"<BR>CONFIG="/etc/mrtg/mrtg.cfg"<BR>PIDFILE="/var/run/mrtg.pid"<BR>LOCKFILE="/var/lock/mrtg/mrtg"
<BR>OPTIONS="--daemon"<BR><BR>RETVAL=0<BR><BR>start() {<BR>        echo -n $"Enabling MRTG: "<BR>        rm -f ${LOCKFILE} 2> /dev/null<BR>        env LANG=C ${MRTG} --pid-file=${PIDFILE} --lock-file=${LOCKFILE} ${OPTIONS} ${CONFIG}
<BR>        RETVAL=$?<BR>        echo<BR>}<BR><BR>stop() {<BR>        echo -n $"Disabling MRTG: "<BR>        kill `cat ${PIDFILE}` && rm -f ${LOCKFILE}<BR>        RETVAL=$?<BR>        echo<BR>}<BR><BR>restart() {<BR>        stop<BR>        start<BR>}<BR><BR>case "$1" in
<BR> start)<BR>        start<BR>        ;<BR> stop) <BR>        stop<BR>        ;<BR> restart|force-reload)<BR>        restart<BR>        ;<BR> status)<BR>        if [ -f $LOCKFILE ]; then<BR>                echo $"MRTG is enabled."<BR>                RETVAL=0<BR>        else<BR>                echo $"MRTG is disabled."
<BR>                RETVAL=3<BR>        fi<BR>        ;<BR> *)<BR>        echo $"Usage: $0 {start|stop|status|restart|force-reload}"<BR>        exit 1<BR>esac<BR><BR>exit $RETVAL</PRE><BR></BLOCKQUOTE></BODY></HTML>