jenkins自动化脚本配置
Posted chenlianyong19890418
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jenkins自动化脚本配置相关的知识,希望对你有一定的参考价值。
#!/bin/sh
cd /work/his
DATE=`date ‘+%Y%m%d-%H%M‘`
file="$DATE.main-1.0.jar"
cp /work/main-1.0.jar /work/his/$file
RESOURCE_NAME=main-1.0.jar
tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk ‘{print $2}‘`
if [ ${tpid} ]; then
echo ‘Stop Process...‘
kill -15 $tpid
fi
sleep 5
tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk ‘{print $2}‘`
if [ ${tpid} ]; then
echo ‘Kill Process!‘
kill -9 $tpid
else
echo ‘Stop Success!‘
fi
tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk ‘{print $2}‘`
if [ ${tpid} ]; then
echo ‘App is running.‘
else
echo ‘App is NOT running.‘
fi
rm -f tpid
source /etc/profile
nohup java -jar ./$RESOURCE_NAME
echo $! > tpid
echo Start Success!
以上是关于jenkins自动化脚本配置的主要内容,如果未能解决你的问题,请参考以下文章
jenkin运行jmeter自动化脚本(jenkins+jmeter+ant)