
HugoBorgesMCP
(usa KUbuntu)
Enviado em 16/10/2008 - 17:05h
Ae pessoal eu fiz um script para fazer backup de um roteador ciso.
#!/usr/bin/expect -f
set timeout -1
exp_send_user "Password? : "
stty -echo
expect_user -re "(.*)\n" {set password $expect_out(1,string)}
exp_send_user "Senha do enable? : "
stty -echo
expect_user -re "(.*)\n" {set ena $expect_out(1,string)}
spawn -noecho telnet IPDOROTEADOR
expect "Password:"
exp_send "$password\r"
expect "canopy>"
exp_send "ena\r"
expect "Password:"
exp_send "$ena\r"
expect "canopy#"
exp_send "copy startup-config tftp\r"
expect "Address or name of remote host []?"
exp_send "10.155.250.150\r"
set data [exec date +%d-%m-%Y-%H.%M]
expect "Destination filename [startup-config]?"
exp_send "startup-canopy-$data\r"
expect "canopy#"
exp_send "copy flash tftp\r"
expect "Source filename []?"
exp_send "c2600-i-mz.120-7.T\r"
expect "Address or name of remote host []?"
exp_send "10.155.250.150\r"
expect "Destination filename"
exp_send "flash-canopy-$data\r"
sleep 180
expect "canopy#"
exp_send "quit\r"
exit
Inicialmente ele funcionou uma maravilha
mas depois começou a pula a linha exp_send "10.155.250.150\r"
nao executa essa linha mas.. não sei o que fazer..
alguem tem uma dica ???