[rancid] Re: any way to pass variables to commands being input by nlogin -c ?

john heasley heas at shrubbery.net
Mon Sep 4 17:37:00 UTC 2006


Mon, Sep 04, 2006 at 10:33:16AM -0400, psmith at metafore.ca:
> 
> Hi again,
> 
> I am using rancid to modify configs on 500 Netscreen devices. Thanks to the
> developers, it has cut down the amount of work needed manually.
> 
> I have written a script which modifies most of the configs, but I was
> wondering if it is possible to use variables i.e. $2 $3 inside of the
> commands being passed with nlogin -c ?

I think that you want nlogin -E, see clogin(1)

> i.e. nlogin -c 'set hostname host_$1; set modem isp "Dialup" account login
> "host_$1 at dialupisp.net" password "password", save' -t 3000 $2
> 
> I did attempt it, but must have done something wrong, or it can't be done,
> because I got a bunch of errors spat back at me.
> 
> [rancid at monitor ~]$ ./scripted-config-update.sh 9130 xxx.xxx.xxx.xxx
> can't read "2": no such variable
>     while executing
> "subst [lindex $commands $i]"
>     invoked from within
> "if [ string match "*\;*" "$command" ] {
>         set commands [split $command \;]
>         set num_commands [llength $commands]
> 
>         for {set i 0} {$i < $num_commands} {..."
>     (procedure "run_commands" line 9)
>     invoked from within
> "run_commands $prompt $command"
>     ("foreach" body line 71)
>     invoked from within
> "foreach firewall [lrange $argv $i end] {
>     set firewall [string tolower $firewall]
>     send_user "$firewall\n"
> 
>     set prompt {-> }
> 
>     # Figure o..."
>     (file "/usr/local/rancid/bin/nlogin" line 436)
> 
> Many thanks!
> 
> ---------------------------------------------------
> Paul W. Smith
> Senior Network Operations Engineer
> MCP, SCWSE, SCSA, SCNA, ACE, 3CSA, CNS, CLS, JNCIA-FWV, JNSS-S, JNSA-S
> Enterprise Services
> Metafore IT Solutions
> Direct: 905.362.7290
> Cell: 416.271.6937
> Toll Free: 800.563.7515 x 4086
> psmith at metafore.ca
> http://www.metafore.ca
> 
> M E T A F O R E
> IT SOLUTIONS
> ----------------------------------------------------
> 
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss



More information about the Rancid-discuss mailing list