[rancid] Re: Using Rancid to pus DST changes

Lance rancid at gheek.net
Wed Mar 7 20:54:03 UTC 2007


I would think it would be much easier than that. Use clogin and do it
like so.

for i in `cat /usr/local/rancid/var/BWI/router.db | egrep "cisco:up$" |
sed 's/:.*$//g'`
do
clogin -t 90 -c "conf t;clock summer-time CST recurring 2 Sun Mar 2:00 1
Sun Nov 2:00;exit;wr mem;exit" $i
done

I wouldn't use end if you have a big mix of IOS versions. Some will not
support the word end to return to the cli.

Just change out
egrep "up$"
with
egrep "cat5:up$"
to get the catos devices. Make sure to change the clogin statemetn to
match as well.

-Lance

> -------- Original Message --------
> Subject: [rancid] Re: Using Rancid to pus DST changes
> From: Robin Mordasiewicz <rmordasiewicz at samuelmanutech.com>
> Date: Wed, March 07, 2007 1:43 pm
> To: Todd Heide <Todd at equivoice.com>
> Cc: rancid-discuss at shrubbery.net
>
> On Wed, 7 Mar 2007, Todd Heide wrote:
>
> > How can I use (if I can) rancid to push a configuration change for the DST to all the routers? Basically it is one line,
> > clock summer-time CST recurring 2 Sun Mar 2:00 1 Sun Nov 2:00
>
> One thing you can use is expect. Here is a simple example expect script
> which you can run on each router which looping through your router.db file
>
> [ myusername at localhost ]$ expect -f summertime_DST.exp myrouter.mydomain.com
>
> < summertime_DST.exp >
> #!/usr/bin/expect -f
> #
> set force_conservative 0  ;# set to 1 to force conservative mode even if
>                            ;# script wasn't run conservatively originally
> if {$force_conservative} {
>          set send_slow {1 .1}
>          proc send {ignore arg} {
>                  sleep .1
>                  exp_send -s -- $arg
>          }
> }
>
> set timeout -1
> set userid "myusername"
> set vtypasswd "mypassword"
> set rtr [lindex $argv 0]
>
> spawn telnet $rtr
> match_max 100000
>
> expect {
>           {Username}   { send "$userid\r"
>                          expect {
>                                    {*Password*} { send "$vtypasswd\r" }
>                                 }
>                        }
>           {telnet>}    { send_user "$rtr - telnet failed\n"
>                         exit
>                        }
>           {Password}   { send "$vtypasswd\r" }
>         }
>
>
>
> send -- "conf t\r"
> send -- "clock summer-time $DST_timezone recurring 2 Sun Mar 2:00 1 Sun Nov 2:00\r"
> send -- "wr mem\r"
> send -- "end\r"
> send -- "exit\r"
>
> expect eof
>
> < /summertime_DST.exp >
>
> _______________________________________________
> 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