jenkins 配置java启动脚本

BUILD_ID=donKillMe
echo "打包路径 /root/.jenkins/workspace/census_gaoyou_test/target"

cp ${WORKSPACE}/target/census_gaoyou.jar /home/census_gaoyou/census_gaoyou.jar;

cd /home/census_gaoyou;
AppName=census_gaoyou.jar;
PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`

if [ x"$PID" != x"" ]; then
	kill -9 $PID
	echo "$AppName (pid:$PID) exiting..."
	sleep 3
else
	echo "$AppName already stopped."
fi

rm -f nohup.out
nohup java -jar $AppName --spring.profiles.active=test >/dev/null 2>&1 &
echo "Start $AppName success..."

你可能感兴趣的:(java,jenkins,开发语言)