部署sh

#!/usr/bin/expect
set timeout 20
set username xxx
set password sxxx

spawn scp /home/appxxxrovider.zip ${username}@xxx:/app/new-pkg/
expect {
"(yes/no)?"
{
send "yes\n"
expect "*assword:" { send "$password\n"}
}
"*assword:"
{
send "$password\n"
}
}
expect "100%"
spawn scp /home/appdeploy/saxxxovider.zip ${username}@xxx:/app/new-pkg/
expect {
"(yes/no)?"
{
send "yes\n"
expect "*assword:" { send "$password\n"}
}
"*assword:"
{
send "$password\n"
}
}
expect "100%"
spawn ssh ${username}@xx5 "xxxjv-at-proxxapp/new_pkg/libxxat-provider/bin/start.sh ; exit"
expect {
"(yes/no)?"
{
send "yes\n"
expect "*assword:" { send "$password\n"}
}
"*assword:"
{
send "$password\n"
}
}
expect "100%"
spawn ssh ${username}@xxx "unzip -o xxxder /axxp.sh ; sh /app/jv-at-prxxx ; exit"
expect {
"(yes/no)?"
{
send "yes\n"
expect "*assword:" { send "$password\n"}
}
"*assword:"
{
send "$password\n"
}
}
expect "100%"
posted @ 2020-03-30 10:54  千年妖狐  阅读(199)  评论(0编辑  收藏  举报