linux中兩臺虛擬機的鏈接方式

目標服務器須要先開通發送服務器的ip訪問權限和22的ssh權限html

#echo "資源打包結束,開始上傳文件"nginx

/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
EOFweb

 

#刪除遠程文件數據服務器

/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
EOFapp

 

echo "靜態頁面上傳完成"ssh

exitwebapp

相關文章
相關標籤/搜索