Discussion:
[rancid] Script with cisco-reload.exp
Christophe Terpreau
2007-04-20 12:11:49 UTC
Permalink
hello,

i'm using a script found in this mailing list to execute some commands
on devices listed in routers.db:

clogin -x yourscript ` find . -name router.db | xargs awk -F: '$3 ==
"up" && $2 == "cisco" && $1 !~ /^#/ {print $1}'`

I would like to schedule a reboot with "clogin -Ereload_arg='at
07:15' -s cisco-reload.exp" on the same devices list in router.db but
"xargs awk -F: '$3 == "up" && $2 == "cisco" && $1 !~ /^#/ {print $1}'`
" seems not working.

Thx if you can help me on this.

Bye.
john heasley
2007-04-20 16:31:45 UTC
Permalink
Post by Christophe Terpreau
hello,
i'm using a script found in this mailing list to execute some commands
clogin -x yourscript ` find . -name router.db | xargs awk -F: '$3 ==
"up" && $2 == "cisco" && $1 !~ /^#/ {print $1}'`
I would like to schedule a reboot with "clogin -Ereload_arg='at
07:15' -s cisco-reload.exp" on the same devices list in router.db but
"xargs awk -F: '$3 == "up" && $2 == "cisco" && $1 !~ /^#/ {print $1}'`
" seems not working.
Thx if you can help me on this.
I expect that to work, but you haven't described the failure. try a loop;

for rtr in `find ...` do
clogin -s ... $rtr
done
john heasley
2007-04-20 16:54:55 UTC
Permalink
In fact there is no failure but only first ip in routers.db is used.
indeed;

expect {
timeout { send_error "Error: timeout waiting for EOF after quit\
n"}
eof { exit 0 }
^^^^^^

The script calls exit.
Post by john heasley
Post by Christophe Terpreau
hello,
i'm using a script found in this mailing list to execute some commands
clogin -x yourscript ` find . -name router.db | xargs awk -F: '$3 ==
"up" && $2 == "cisco" && $1 !~ /^#/ {print $1}'`
I would like to schedule a reboot with "clogin -Ereload_arg='at
07:15' -s cisco-reload.exp" on the same devices list in router.db but
"xargs awk -F: '$3 == "up" && $2 == "cisco" && $1 !~ /^#/ {print $1}'`
" seems not working.
Thx if you can help me on this.
I expect that to work, but you haven't described the failure. try a loop;
for rtr in `find ...` do
clogin -s ... $rtr
done
Loading...