jenkins 打包部署springboot应用,后台启动

1、相关的插件安装

Maven Integration plugin、Publish Over SSH

2、上传文件和执行脚本



3、附上脚本

#!/bin/bash

cd /usr/local/monitor

./stop.sh

nohup > /dev/null  sh start.sh

#start.sh内容

#!/bin/sh

export JAVA_HOME=/usr/jdk64/jdk1.8.0_60

echo ${JAVA_HOME}

echo "执行....."

${JAVA_HOME}/bin/java -jar /usr/local/monitor/xxx.jar --spring.profiles.active=test &

echo "启动成功…"

?xml version="1.0" encoding="UTF-8"?

#stop.sh内容

#!/bin/bash

APP_NAME="xxxx.jar"

echo "stop SpringBoot Application"

pid=`ps -ef | grep $APP_NAME | grep -v grep | awk '{print $2}'`

if [ -n "$pid" ]

then

kill -9 $pid

fi


你可能感兴趣的:(工具使用)