博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jenkens构建脚本
阅读量:6126 次
发布时间:2019-06-21

本文共 2919 字,大约阅读时间需要 9 分钟。

Build
  Root POM
  Goals and options
Command
 
 
 
# consts
SERVER="192.168.60.209"
DEPLOY="ROOT"
SERIVCE="ddcms"
OUT_TGT="target/ddcms.war"
RELEASE_DIR="${WORKSPACE}/.release"
SSH_OPTS="-i ${JENKINS_HOME}/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
 
# uncompress jetty war
[ -d "${RELEASE_DIR}" ] && rm -rf "${RELEASE_DIR}"
/bin/mkdir "${RELEASE_DIR}" 2>/dev/null
/usr/bin/unzip ${WORKSPACE}/${OUT_TGT} -d "${RELEASE_DIR}"
/usr/bin/git rev-parse HEAD > "${RELEASE_DIR}/.revision"
 
# purge code via ssh
/usr/bin/ssh ${SSH_OPTS} \
root@${SERVER} "rm -rf /opt/phoenix/deploy/${SERIVCE}/webapps/${DEPLOY}/WEB-INF/classes"
 
/usr/bin/ssh ${SSH_OPTS} \
root@${SERVER} "rm -rf /opt/phoenix/deploy/${SERIVCE}/webapps/${DEPLOY}/WEB-INF/lib"
/usr/bin/ssh ${SSH_OPTS} \
root@${SERVER} "rm -rf /opt/phoenix/deploy/${SERIVCE}/webapps/${DEPLOY}/WEB-INF/web.xml"
 
# push git revision tag via ssh
/usr/bin/scp ${SSH_OPTS} \
${RELEASE_DIR}/.revision root@${SERVER}:"/opt/phoenix/deploy/${SERIVCE}/webapps/${DEPLOY}"
 
 
# push code via scp
/usr/bin/scp -r ${SSH_OPTS} \
${RELEASE_DIR}/WEB-INF/classes root@${SERVER}:"/opt/phoenix/deploy/${SERIVCE}/webapps/${DEPLOY}/WEB-INF/"
 
/usr/bin/scp -r ${SSH_OPTS} \
${RELEASE_DIR}/WEB-INF/lib root@${SERVER}:"/opt/phoenix/deploy/${SERIVCE}/webapps/${DEPLOY}/WEB-INF/"
/usr/bin/scp -r ${SSH_OPTS} \
${RELEASE_DIR}/WEB-INF/web.xml root@${SERVER}:"/opt/phoenix/deploy/${SERIVCE}/webapps/${DEPLOY}/WEB-INF/"
 
# restart the service
/usr/bin/ssh ${SSH_OPTS} root@${SERVER} "/sbin/service ${SERIVCE} restart"
 

 

 

 

ssh -o "StrictHostKeyChecking no" root@192.168.60.100  "rm -rf /opt/bangumi.acfun.tv/bangumi/WEB-INF/lib/*"

scp -r $WORKSPACE/target/acfun-bangumi/WEB-INF/lib/* root@192.168.60.100:/opt/bangumi.acfun.tv/bangumi/WEB-INF/lib/

ssh root@192.168.60.100  "ps -ef |grep java|grep /opt/bangumi.acfun.tv |grep -v grep|sed  's/ /\\n/g' |grep -v ^$|head -n 2|tail -n 1|xargs kill -9 |echo 0"

ssh root@192.168.60.100 "service bangumi.acfun.tv start”

ssh root@192.168.60.100 "rm -rf /opt/jetty-bangumi/jetty-base/webapps/*"

scp -r ${WORKSPACE}/acfun-bangumi/target/acfun-bangumi-*.war root@192.168.60.100:/opt/jetty-bangumi/jetty-base/webapps/ROOT.war

ssh root@192.168.60.100 "unzip /opt/jetty-bangumi/jetty-base/webapps/ROOT.war -d /opt/jetty-bangumi/jetty-base/webapps/ROOT"

ssh root@192.168.60.100 "rm -rf /opt/jetty-bangumi/jetty-base/webapps/ROOT.war"

ssh root@192.168.60.100 "service jetty-bangumi restart >/dev/null &"

ssh root@192.168.60.100 "rm -rf /opt/jetty-bangumi/jetty-base/webapps/*"

scp -r ${WORKSPACE}/acfun-bangumi/target/acfun-bangumi-*.war root@192.168.60.100:/opt/jetty-bangumi/jetty-base/webapps/ROOT.war

ssh root@192.168.60.100 "unzip /opt/jetty-bangumi/jetty-base/webapps/ROOT.war -d /opt/jetty-bangumi/jetty-base/webapps/ROOT"

ssh root@192.168.60.100 "rm -rf /opt/jetty-bangumi/jetty-base/webapps/ROOT.war"

ssh root@192.168.60.100 "service jetty-bangumi restart >/dev/null &”

转载地址:http://xkbua.baihongyu.com/

你可能感兴趣的文章
DEV实现日期时间效果
查看>>
java注解【转】
查看>>
Oracle表分区
查看>>
centos 下安装g++
查看>>
嵌入式,代码调试----GDB扫盲
查看>>
类斐波那契数列的奇妙性质
查看>>
配置设置[Django]引入模版之后报错Requested setting TEMPLATE_DEBUG, but settings are not configured....
查看>>
下一步工作分配
查看>>
Response. AppendHeader使用大全及文件下载.net函数使用注意点(转载)
查看>>
Wait Functions
查看>>
代码描述10313 - Pay the Price
查看>>
jQuery最佳实践
查看>>
centos64i386下apache 403没有权限访问。
查看>>
vb sendmessage 详解1
查看>>
jquery用法大全
查看>>
Groonga 3.0.8 发布,全文搜索引擎
查看>>
PC-BSD 9.2 发布,基于 FreeBSD 9.2
查看>>
网卡驱动程序之框架(一)
查看>>
css斜线
查看>>
Windows phone 8 学习笔记(3) 通信
查看>>