1、Springboot项目脚本
#!/bin/bash
export BUILD_ID=dontKillMe
www_path=/home/jenkins
jar_path=/home/jenkins/smp-boot/target/
jar_name=smp-boot-1.0.1.jar
pid=$(cat /home/jenkins/smp-boot.pid)
cd ${jar_path}
cp -f ${jar_path}/${jar_name} ${www_path}
cd ${www_path}
kill -9 ${pid}
nohup java -jar ${jar_name} > out.log &
echo $! > /home/jenkins/smp-boot.pid
服务器shell脚本
#!/bin/bash
export BUILD_ID=dontKillMe
www_path=/home/jenkins
jar_path=/home/jenkins/smp-boot/target/
jar_name=smp-boot-1.0.1.jar
pid=$(cat /home/jenkins/smp-boot.pid)
cd ${jar_path}
cp -f ${jar_path}/${jar_name} ${www_path}
cd ${www_path}
kill -9 ${pid}
nohup java -jar ${jar_name} > out.log 2>&1 &
echo $! > /home/jenkins/smp-boot.pid
2、Vue项目脚本
构建
rm -rf dist
rm -f dist.tar.gz
npm install --registry=https://registry.npm.taobao.org
npm run build:prod
tar -zcf dist.tar.gz dist
构建后操作
cd /home/jenkins
rm -rf smp
tar zxvf /home/jenkins/smp-web/dist.tar.gz
mv dist smp