标签:root 目标 timeout 方式 test exp home bsp 连接
目标服务器需要先开通发送服务器的ip访问权限和22的ssh权限
#echo "资源打包结束,开始上传文件"
/usr/bin/expect << EOF
set timeout 3600
spawn scp -r /root/dist nginx@test.webapp:/home/web/html/static/app
expect {
"(yes/no)?" {
send "yes\n"
expect "*assword:" { send "123456\n"}
}
"*assword:" {
send "123456\n"
}
}
expect "100%"
expect "exit\n"
expect eof
EOF
#删除远程文件数据
/usr/bin/expect << EOF
set timeout 3600
spawn ssh root@test.webapp rm /home/web/html/static/app/*
expect {
"(yes/no)?" {
send "yes\n"
expect "*assword:" { send "123456\n"}
}
"*assword:" {
send "123456\n"
}
}
expect "100%"
expect "exit\n"
expect eof
EOF
echo "静态页面上传完成"
exit
标签:root 目标 timeout 方式 test exp home bsp 连接
原文地址:https://www.cnblogs.com/hr-cmbc/p/11494375.html