当前位置: 首页 > news >正文

springboot web应用 jar 启动 ant脚本

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

start.sh

###启动
#!/bin/sh
pidPath="face-in-pid"
rm -f $pidPath
rm -f out.log
nohup java -jar -Dlogging.path=/app/log/face-in /app/www/face-in.jar -server >out.log 2>&1 &
echo $! > $pidPath

stop.sh

###停止
tpid=`cat face-in-pid | awk '{print $1}'`
tpid=`ps -aef | grep $tpid | awk '{print $2}' |grep $tpid`
if [ ${tpid} ]; then
kill -9 $tpid
fi

build.xml

<?xml version="1.0" encoding="UTF-8"?>

<project name="ant-demo" basedir="." default="build">

    <tstamp>
        <format property="time" pattern="yyyy-MM-dd HH:mm:ss"/>
        <format property="date" pattern="yyyy-MM-dd"/>
    </tstamp>

    <property name="M2_HOME" value="/app/env/apache-maven-3.3.3"/>

    <!--<property environment="SystemVariable"/>-->
    <property name="repository_address" value="git@gitee.com:username/ant-demo.git"/>
    <property name="srcdir" value="${basedir}/ant-demo"/>
    <property name="fixdir" value="${basedir}/patch"/>

    <property name="in_bin_jar" value="${srcdir}/face-in-web-controller/target/face-in.jar"/>
    <property name="in_dir" value="/app/www/face-in"/>
    <property name="in_jar" value="/app/www/face-in.jar"/>
    <!--
        <property name="dbdir" value="${srcdir}/src/main/resources"/>
        <property name="dbdriver" value="com.mysql.jdbc.Driver"/>
        <property name="dburl" value="jdbc:mysql://127.0.0.1:3306/?useUnicode=true&amp;characterEncoding=utf8"/>
        <property name="dbusername" value="root"/>
        <property name="dbpassword" value="Lr123456"/>
    -->
    <!-- <property name="r" value="HEAD"/> -->
    <property name="r" value="master"/>

    <patternset id="resources">
        <include name="**/?*.properties"/>
        <include name="**/?*.xml"/>
        <include name="**/?*.dtd"/>
        <include name="**/?*.tld"/>
        <include name="**/?*.ftl"/>
        <include name="**/?*.txt"/>
        <include name="**/?*.vm"/>
    </patternset>

    <condition property="usefix">
        <available file="${fixdir}" type="dir"/>
    </condition>

    <target name="clean">
        <delete dir="${srcdir}"/>
    </target>

    <target name="patch" if="usefix">
        <unzip dest="${srcdir}">
            <fileset dir="${fixdir}" includes="*.zip"/>
        </unzip>
    </target>

    <target name="checkout" depends="clean">
        <echo message="checkout revision:[${r}]"/>
        <exec dir="${basedir}" executable="git">
            <arg line="clone -b ${r} ${repository_address}"/>
        </exec>
        <echo message="checkout complete !"/>
    </target>

    <target name="update">
        <echo message="update revision:[${r}]"/>
        <exec dir="${srcdir}" executable="git">
            <arg line="pull"/>
        </exec>
        <echo message="update complete !"/>
    </target>

    <target name="package" depends="patch">
        <exec dir="${srcdir}" executable="${M2_HOME}/bin/mvn">
            <arg line="clean package -U -DskipTests"/>
        </exec>
    </target>

    <target name="build">
        <antcall target="package"/>
    </target>

    <target name="rebuild" depends="clean, checkout, build"/>

    <target name="deploy">
        <copy file="${in_bin_jar}" tofile="${in_jar}" overwrite="true"/>
    </target>

    <target name="redeploy">
        <delete dir="${in_dir}"/>
        <delete file="${in_jar}"/>
        <antcall target="deploy"/>
    </target>

    <!-- tomcat -->
    <target name="stop">
        <exec executable="./stop.sh" failonerror="false">
            <arg value="stop"/>
        </exec>
        <sleep seconds="5"/>
    </target>

    <target name="do-start">
        <exec executable="./start.sh" failonerror="false">
            <arg value="start"/>
        </exec>
        <!-- <waitfor maxwait="5" maxwaitunit="second" checkevery="500">
          <http url="http://127.0.0.1:8080/ping.html"/>
        </waitfor>
        <echo message="ok" /> -->
        <sleep seconds="15"/>
    </target>

    <target name="start" depends="stop, do-start">
        <echo message="DONE!!!!"/>
    </target>

    <target name="auto" depends="stop,rebuild,redeploy,do-start">
        <echo message="DONE!!!!"/>
    </target>

    <target name="help">
        <echo message="Ant 参数说明"/>
        <echo message="-    clean : 删除所有源程序"/>
        <echo message="- checkout : 从GIT获取最新的源程序"/>
        <echo message="-    build : 编译部署项目 : [*默认]"/>
        <echo message="-  rebuild : 依次执行 clean, checkout, build"/>
        <echo message="-    patch : 解压缩patch目录下的zip包,并拷贝到src目录"/>
        <echo message="-   deploy : 部署到www目录"/>
        <echo message="- redeploy : 删除旧代码部署到www目录"/>
        <echo message="-  do-start : 启动tomcat"/>
        <echo message="-     stop : 停止tomcat"/>
        <echo message="-     auto : 依次执行 stop, redeploy, start"/>
    </target>
</project>

 

转载于:https://my.oschina.net/u/3664884/blog/1593698

相关文章:

  • 中国移动与苹果联姻 三星在华霸主地位或遭取代
  • 微信公众号支付PHP-SDK的一个BUG
  • 一致性hash的C++实现
  • Swift枚举相关值
  • 去重排序
  • .NET Core中的去虚
  • php获取数组长度的方法
  • 恢复误删除的ESXi服务器存储VMFS卷
  • .NET 反射的使用
  • vim/vi卡死
  • ECSHOP修改后台地址
  • WebCast听课录(5)
  • 数字音乐维权联盟首次出招 QQ音乐起诉酷我索赔千万
  • Pure-ftpd无法连接到服务器 425错误
  • 华为交换机ntp设置
  • [笔记] php常见简单功能及函数
  • 【399天】跃迁之路——程序员高效学习方法论探索系列(实验阶段156-2018.03.11)...
  • 【腾讯Bugly干货分享】从0到1打造直播 App
  • android高仿小视频、应用锁、3种存储库、QQ小红点动画、仿支付宝图表等源码...
  • npx命令介绍
  • PHP变量
  • spring boot 整合mybatis 无法输出sql的问题
  • Spring Cloud Feign的两种使用姿势
  • vuex 学习笔记 01
  • Vue--数据传输
  • 猫头鹰的深夜翻译:Java 2D Graphics, 简单的仿射变换
  • 前端_面试
  • 容器服务kubernetes弹性伸缩高级用法
  • 如何进阶一名有竞争力的程序员?
  • 深度学习中的信息论知识详解
  • 事件委托的小应用
  • 小程序、APP Store 需要的 SSL 证书是个什么东西?
  • - 语言经验 - 《c++的高性能内存管理库tcmalloc和jemalloc》
  • 树莓派用上kodexplorer也能玩成私有网盘
  • ​​​​​​​sokit v1.3抓手机应用socket数据包: Socket是传输控制层协议,WebSocket是应用层协议。
  • ​LeetCode解法汇总2182. 构造限制重复的字符串
  • #我与虚拟机的故事#连载20:周志明虚拟机第 3 版:到底值不值得买?
  • $.ajax,axios,fetch三种ajax请求的区别
  • (0)Nginx 功能特性
  • (2)Java 简介
  • (2)STM32单片机上位机
  • (LeetCode C++)盛最多水的容器
  • (附源码)springboot“微印象”在线打印预约系统 毕业设计 061642
  • (简单有案例)前端实现主题切换、动态换肤的两种简单方式
  • (论文阅读22/100)Learning a Deep Compact Image Representation for Visual Tracking
  • (三)模仿学习-Action数据的模仿
  • (四)汇编语言——简单程序
  • (转)负载均衡,回话保持,cookie
  • .FileZilla的使用和主动模式被动模式介绍
  • .gitignore文件_Git:.gitignore
  • .net core 依赖注入的基本用发
  • .NET Framework杂记
  • .NET Remoting Basic(10)-创建不同宿主的客户端与服务器端
  • .NET 设计一套高性能的弱事件机制
  • .net 逐行读取大文本文件_如何使用 Java 灵活读取 Excel 内容 ?