上一篇文章有讲到一些基本的配置,这里就不再重复了。
这里主要说下Exec command配置
注:以上适用于svn部署的项目。
命令如下:
//以下所有********.jar代表jar包名称
source /etc/profile
cd /var/lib/jenkins/workspace/项目名 //这里是项目地址
isServerExist=`ps -ef|grep target/********.jar|grep -v "grep"|wc -l`
if [ "$isServerExist" = "1" ]; then
pid=`ps -ef|grep target/********.jar |grep -v "grep" | awk '{print $2}'`
kill $pid
fi
BUILD_ID=dontKillMe
nohup java -jar target/********.jar --spring.profiles.active=pro >> yzt_api_log.file 2>&1 &