代码拉取完成,页面将自动刷新
#!/usr/local/bin/expect -f
#variable
set service_user root
set service_ip 39.105.212.213
set service_pwd XjQLzM4_TW.9F2W
set service_port 22
set scp_source_path target/smarts.jar
set scp_to_path /root/smarts
set service_app_path /root/smarts
set timeout -1
# bash shell
spawn $env(SHELL)
match_max 100000
expect -exact ""
# pack
#send -- "cd $pack_path\r"
#expect -exact "cd $pack_path"
send -- "mvn clean && mvn package --settings /Users/zhanghong/opt/apache-maven-3.6.3/conf/settings.xml\r"
expect -exact "mvn package --settings /Users/zhanghong/opt/apache-maven-3.6.3/conf/settings.xml"
# scp
send -- "scp -P$service_port $scp_source_path $service_user@$service_ip:$scp_to_path\r"
expect -exact "$service_user@$service_ip's password: "
send -- "$service_pwd\r"
expect -exact ""
# restart app
send -- "ssh -p $service_port $service_user@$service_ip\r"
expect -exact "$service_user@$service_ip's password: "
send -- "$service_pwd\r"
expect -exact ""
send -- "cd $service_app_path\r"
expect -exact ""
send "sh start.sh\r"
# done
interact
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。