Acceso remoto!!
Para accesar remotamente, ya sea por telnet o ssh y
que se ejecuten comandos en una maquina se puede
lograr por expect.
Aqui les mando un ejemplo.
#!/usr/bin/expect -f
if $argc<2 {
send_user "$argv0: expect telnet.exp login pass\n"
exit
}
set login [lindex $argv 0]
set password [lindex $argv 1]
set timeout 60
spawn telnet "xxx.xx.x.xx"
expect "ogin:"
send -- "$login\r"
expect "assword:"
send -- "$password\n"
expect {
"Login" { puts "\n\nERROR: No se pudo establecer
conexion con el servidor, verificar login y
password\n";exit;}
timeout { puts "El programa ha finalizado por
tiempo.\n";exit}
}
exit
Suerte
CALlanoR
__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
Reply to: