linux in two virtual machine connections

ip access target servers need to open the sending server and ssh permissions 22

#echo "resource pack end, start uploading files."

/usr/bin/expect << EOF
set timeout 3600
spawn scp -r  /root/dist [email protected]:/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

 

# Delete remote file data

/usr/bin/expect << EOF
set timeout 3600
spawn ssh [email protected]      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 "Upload Complete static page"

exit

Guess you like

Origin www.cnblogs.com/hr-cmbc/p/11494375.html