欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

jenkins自动部署springboot项目脚本

程序员文章站 2022-03-30 08:51:26
...

jenkins自动构建好jar包,发送到服务器,执行脚本

#!/bin/sh
#restart admin service

pidlist=`ps -ef|grep littlebird-admin | grep -v "grep"|awk '{print $2}'`

if [ ! -f "/usr/local/admin/littlebird-admin-0.0.1-SNAPSHOT.jar" ]; then
	echo "littlerbird-admin jar not exists"
	exit

fi

if [ "$pidlist" = "" ];then 
	echo "no admin service starting"
	
else
	echo "admin service pid list : $pidlist"
	echo "kinlling pid list : $pidlist"
	kill -9 $pidlist
	echo "admin service stopped successfully!"
	sleep 2
fi

echo "start admin service now"

nohup  java -jar /usr/local/admin/littlebird-admin-0.0.1-SNAPSHOT.jar >admin.out 2>&1 &

echo "admin service starting successfully!"