mac 项目部署

#!/bin/bash
cd /workspace/GW/mybitauto-operation
#替换环镜变量配置信息 src/main/resources/application.properties
sed -i '' 's/active=.*/active: prod/g' src/main/resources/application.properties


# git pull


mvn clean package


/usr/bin/expect <<-EOF
#参数设置
set timeout 1000
#sftp连接
spawn scp  mybitauto-admin/target/mybitauto-admin.jar [email protected]:/data/yy.mybitauto.com/yy.mybitauto.com.jar


#第一次sftp时需输入yes
expect {
    "(yes/no)?" {send "yes\r"; exp_continue}
    "password:" {
        send "Mybitauto@2018\r"
        }
}
expect "*#"
spawn ssh [email protected]
expect "*password:"
send "Mybitauto@2018\r"
expect "*#"
send "cd /data/yy.mybitauto.com/\r"
expect "*#"
send "rm -rf log.log\r"
send "ps aux | grep yy.mybitauto.com  | cut -c 9-15 | xargs kill -9\r"
send "nohup java -server -jar yy.mybitauto.com.jar --spring.profiles.active=prod>nohup.log 2>&1 &\r"
send "exit\r"
expect eof


EOF

猜你喜欢

转载自blog.csdn.net/yz18931904/article/details/80593985