<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3199" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2>As John H already mentioned, xargs(1) is your friend
here. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN><SPAN class=275080019-15102007><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2>Start with a text file listing your devices, one
per line. If you don't have this already try cut(1) on your
router.db file.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2>I'll provide a few examples.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2>Run the commands in cmds.txt on the devices listed in
devices.txt:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2>cat devices.txt | xargs clogin -x
cmds.txt</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2>If the commands need to include the device name as James
requested, create a custom script that runs the right command when passed
the devicename. Then pass this script the devices in
the list one at a time:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2>cat devices.txt | xargs -n1
customscript.sh</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2> </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007><FONT face=Arial
color=#0000ff size=2>Mike</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=275080019-15102007> </SPAN></DIV>
<DIV dir=ltr align=left>
<HR tabIndex=-1>
</DIV>
<DIV dir=ltr align=left><FONT face=Tahoma size=2><B>From:</B>
rancid-discuss-bounces@shrubbery.net
[mailto:rancid-discuss-bounces@shrubbery.net] <B>On Behalf Of </B>Chris
Stave<BR><B>Sent:</B> Monday, October 15, 2007 9:58 AM<BR><B>To:</B> Munroe,
James (DSS/MAS)<BR><B>Cc:</B> rancid-discuss@shrubbery.net<BR><B>Subject:</B>
[rancid] Re: Newbie Question...sorry!<BR></FONT><BR></DIV>
<DIV></DIV>I've made a script to call clogin, our devices are numbered fairly
sequentially, from <A onclick="return top.js.OpenExtLink(window,event,this)"
href="http://10.0.0.1/" target=_blank>10.0.0.1</A> to <A
onclick="return top.js.OpenExtLink(window,event,this)" href="http://10.0.0.86/"
target=_blank>10.0.0.86</A> with cluster members getting 10.0.1.x and 10.0.2.x ,
etc... <BR>I put whatever commands I want to run into cmds.txt and then make
sure that the switches I want those commands run on are represented in the
script. A slight change to this would be to put the actual command you
want to run in in place of the cmds.txt, which would make it easy to specify the
ip address as a filename for the log.<BR><BR>This obviously works better if your
devices are all similarly numbered.<BR><BR>I've appended the script, but do note
that it won't work for you without changes, but just as an example of how I did
it. I suspect that there is a cleaner way to do the conditional
statements, but this way worked for me. (As a bonus, is there an easy way to
avoid the repeated "-o $i =" in the script below?)
<BR><BR>******************************
<DIV id=mb_1>************************************************************<BR>for
(( i = 1; i <= 86; i++
))<BR>do<BR> /home/rancid/bin/clogin -x /home/rancid/cmds.txt 10.0.0.$i
<BR>if [ $i = 6 -o $i = 12 -o $i = 13 -o $i = 14 -o $i = 16 -o $i = 19 -o $i =
23 -o <BR> $i = 27 -o $i = 30 -o $i = 32 -o $i = 37 -o $i = 44 -o $i = 45
-o $i = 46 -o $i<BR> = 48 -o $i = 49 -o $i = 52 -o $i = 53 -o $i = 55 -o $i
= 56 -o $i = 57 -o $i =<BR>58 -o $i = 59 -o $i = 60 -o $i = 61 -o $i = 64 -o $i
= 65 -o $i = 70 -o $i = 71 <BR>-o $i = 81 -o $i = 72 -o $i = 73 -o $i = 77 -o $i
= 82 -o $i = 83 -o $i = 84 -o<BR>$i = 85 -o $i = 86 ];
then<BR> /home/rancid/bin/clogin -x /home/rancid/cmds.txt
10.0.1.$i<BR>fi<BR>if [ $i = 6 -o $i = 12 -o $i = 14 -o $i = 23 -o $i = 37 -o $i
= 44 -o $i = 45 -o <BR> $i = 52 -o $i = 53 -o $i = 57 -o $i = 61 -o $i = 64
-o $i = 72 -o $i = 73 -o $i<BR> = 77 -o $i = 83 -o $i = 86 ];
then<BR> /home/rancid/bin/clogin -x /home/rancid/cmds.txt
10.0.2.$i<BR>fi<BR>if [ $i = 6 -o $i = 12 -o $i = 37 -o $i = 53 -o $i = 57 -o $i
= 61 -o $i=64 ]; t <BR>hen<BR> /home/rancid/bin/clogin -x
/home/rancid/cmds.txt
10.0.3.$i<BR>fi<BR>done<BR><BR>*******************************************************************************************************8<BR><BR>good
luck with it! </DIV><BR><BR>
<DIV><SPAN class=gmail_quote>On 10/15/07, <B class=gmail_sendername>Munroe,
James (DSS/MAS)</B> <<A
href="mailto:James.Munroe@gnb.ca">James.Munroe@gnb.ca</A>> wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Hello,<BR><BR>Could
someone please tell me if there is a way to add a variable to a command file
for processing with nlogin? For example I want to issue the
following command on 170 simliar devices: "get event > tftp <A
href="http://192.168.1.1">192.168.1.1</A>
<ROUTERNAME>.log" The <ROUTERNAME> needs to be unique
for each device. I don't care if it's the device's IP or hostname
or whatever...as long as it is unique. Hostname or IP would be nice
though :-) <BR><BR>Also when using nlogin or clogin what's the easiest way to
specify a large number of remote devices? I've got like 380+
firewalls and routers that I'd like to issue a nlogin/clogin
against. I know the command line gives you the option to list each
deviceon the same command line...but I was looking for something a little more
manageable. I'd eventually like to automate this...or script it.
<BR><BR>Any help or tips would be greatly
appreciated!!!<BR><BR>Thanks!<BR><BR>Jim<BR>_______________________________________________<BR>Rancid-discuss
mailing list<BR><A
href="mailto:Rancid-discuss@shrubbery.net">Rancid-discuss@shrubbery.net
</A><BR><A
href="http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss">http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss</A><BR></BLOCKQUOTE></DIV><BR></BODY></HTML>