首页 > 代码库 > Jenkins
Jenkins
Post Steps
echo ${BUILD_NUMBER} >> /home/xiluhua/test.logecho $JOB_NAME >> /home/xiluhua/test.logecho $JENKINS_HOME/jobs/$JOB_NAME/home/xiluhua/application/tomcat/auto-deploy.sh $JENKINS_HOME/jobs/$JOB_NAME ${BUILD_NUMBER} 8080
auto-deploy.sh
#!/bin/bash# auth: xiluhua# date: 2017-07-26# params:# $1: $JENKINS_HOME/jobs/$JOB_NAME# $2: ${BUILD_NUMBER} # #3: PORTcd $1echo $1echo $2echo $3 cp $(find -name *.war|grep $2) ~/application/tomcat/8080/apache-tomcat-8.0.45/webapps/docsssh -l xiluhua 192.168.178.132 "/home/xiluhua/application/tomcat/restart.sh $3"
restart.sh
#!/bin/bash#auth xilh #time 2017-07-26#Auto deploy Tomcat for jenkins perf#params:# $1: portif [ -z $1 ]then echo "port may not be null" exit 1fiexport JAVA_HOME=/home/xiluhua/application/java/jdk1.8.0_131TOMCAT_PID=`/usr/sbin/lsof -i :$1|grep -v PID|awk ‘{ print $2 }‘`echo $1echo $TOMCAT_PIDTOMCAT_DIR=/home/xiluhua/application/tomcat/$1/apache-tomcat-8.0.45/cd $TOMCAT_DIR;cd webapps/rm 02Helloworld*wget -c http://192.168.178.133:8080/docs/02Helloworld-0.0.1-SNAPSHOT.warcd $TOMCAT_DIR;cd work/rm * -rf;kill -9 $TOMCAT_PIDcd $TOMCAT_DIR;cd bin/sh catalina.sh start exit 0
可能需要主动解压缩 war 包
/usr/java/jdk1.8.0_131/bin/jar -xvf $FILES
Jenkins
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。