proc ftp_getfile {host user key} {
set alist [glob -nocomplain /tmp/access_gw*]
foreach f $alist {
file delete -force $f
}
set timeout 10
spawn ftp $host
expect "Name*"
send "$user\r"
expect "Password:*"
send "$key\r"
expect "successful*"
expect "ftp>*"
send "lcd /tmp\r"
expect "ftp>*"
send "cd update\r"
expect "ftp>*"
send "mget access_gw_*\r"
expect {
"ftp*" { send_user "\n there is not exec file on server! \n";
send "bye\r";
expect eof;
return -1;}
-ex "?" { send "y\r"; }
}
expect "OK";
expect "ftp>*"
send "bye\r";
expect eof;
return 0
}
阅读(1475) | 评论(0) | 转发(0) |