Jenkins自动更名重启shell

1.新建一个maven项目,输入项目名称

2.填写配置


Jenkins自动更名重启shell_第1张图片


Jenkins自动更名重启shell_第2张图片



Jenkins自动更名重启shell_第3张图片

#!/bin/bash

SERVER_NAME=tomcat_crdp

PIDS=`ps -ef | grep java | grep "$SERVER_NAME" |awk '{print $2}'`

if [ -z "$PIDS" ]; then

   echo "ERROR: The $SERVER_NAME does not started!"

else

   echo "kill $SERVER_NAME $PIDS"

   kill -9 $PIDS

fi

echo "delete tomcat files..."

cd /app/release/tomcat_crdp/temp

rm -rf *

cd /app/release/tomcat_crdp/work

rm -rf *

cd /app/release/tomcat_crdp/webapps/

rm -rf *

echo "depoly app files..."

cp /app/jenkins/workspace/crdp/CRDP_2_0/crdp.pc/target/crdp.pc.war /app/release/tomcat_crdp/webapps/

cd /app/release/tomcat_crdp/webapps/

mv crdp.pc.war crdp.war

cd /app/release/tomcat_crdp/bin

echo "start tomcat ...."

sh startup.sh

echo "tomcat is running"

你可能感兴趣的:(Jenkins自动更名重启shell)