• jenkens构建脚本


    Build
     Root POMHelp for feature: Root POM
     Goals and optionsHelp for feature: 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 &”

  • 相关阅读:
    基于Android的学生电子假条管理平台(笔记18)
    基于Android的学生电子假条管理平台(笔记17)
    请假制度管理与责任规避(笔记16)
    高校学生考勤管理系统功能设计(笔记15)
    浅析普通高校考勤请假制度的困境及其解决方法(笔记14)
    浅析普通高校考勤请假制度的困境及其解决方法(笔记13)
    高职大学生非正常请假现象透视(笔记12)
    学校应该完善与落实学生考勤制度——两张与众不同的请假条的故事(笔记11)
    《基于ASP.NET技术的小区物业管理系统设计与实现》论文笔记(二十)
    《基于JSP小区物业信息管理系统的设计与实现》论文笔记(十九)
  • 原文地址:https://www.cnblogs.com/xmanblue/p/6229917.html
Copyright © 2020-2023  润新知