[rancid] Re: Using Rancid to pus DST changes

Todd Heide Todd at equivoice.com
Wed Mar 7 20:53:13 UTC 2007

OK, I will give this a try. There are over 100 devices that need to be
updated, and if this works it will make life so much easier. :)

Todd Heide
Equivoice Inc.

Nothing ever goes as planned, Its a hell of a notion, 
Even pharaohs turn to sand, Like a drop in the ocean

-----Original Message-----
From: Robin Mordasiewicz [mailto:rmordasiewicz at samuelmanutech.com] 
Sent: Wednesday, March 07, 2007 2:43 PM
To: Todd Heide
Cc: rancid-discuss at shrubbery.net
Subject: Re: [rancid] Using Rancid to pus DST changes

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

[ myusername at localhost ]$ expect -f summertime_DST.exp

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

More information about the Rancid-discuss mailing list