#将远程服务器上的文件,下载到本地
#! /bin/bash
passwd="password"
current_date=`date +%Y-%m-%d`
expect -c "
set timeout 10000; ##设置拷贝的时间,根据目录大小决定。
spawn scp remote_user@47.xx.xx.xx:/data/app/tmp.zip /home/localuser/download
expect {
\"*password*\" {send \"$passwd\r\";} ##远程IP的密码。
}
expect eof;"
#将本地的文件,上传到远程服务器
#! /bin/bash
passwd="password"
current_date=`date +%Y-%m-%d`
expect -c "
set timeout 10000; ##设置拷贝的时间,根据目录大小决定。
spawn scp /home/current_user/temp.zip remote_user@10.x.x.x:/data/temp/
expect {
\"*password*\" {send \"$passwd\r\";} ##远程IP的密码。
}
expect eof;"