自动scp(二)
#!/usr/bin/expect -f
spawn scp /shell/bms3acount.txt root@192.168.35.186:/root/BMS/
set timeout 20
expect "(yes/no)?" {
send "yes\r"}
expect "password:" {
send "3344134\r" }
expect eof
#!/usr/bin/expect -f
set timeout 36000
set password tysxtv189
#download
set date [exec date "+%Y-%m"]
spawn scp -l 30000 -P 6022 /data/messlog/backup/msg_$date.txt datacenter@192.168.40.125:/data/ftpsite/duanxin/
#sleep 3600
expect {
"(yes/no)?"
{send "yes\n"}
"password:"
{send "$password\n"}
}
expect eof
exit