zoukankan      html  css  js  c++  java
  • shell 自动部署替换版本和备份

    #!/bin/sh
    tm=`date "+%Y%m%d-%H:%M"`
    home_path=/home/tool_file
    web_source=/opt/server/tomcat/webapps
    his_version_path=/data/client/his_version/$tm
    if [ -f "$home_path/version/client_web.war" ];then
            unzip $home_path/version/pics_client_web.war -d $home_path/version/client_web
    else
            echo 'Package does not exist'
    fi
    if [ -f "$home_path/version/pics_client_web/WEB-INF/classes/spring-context.xml" ];then
            cp $home_path/config/spring-context.xml $home_path/version/client_web/WEB-INF/classes/spring-context.xml
    fi
    if [ -f "$home_path/version/jsapi/Config.js" ];then
            cp $home_path/config/Config.js $home_path/version/jsapi/Config.js
    fi
    for i in {1..5}
            do
                    #count$i=`ps -ef|grep tomcat|grep -v grep|wc -l`
                    if [ `ps -ef|grep tomcat|grep -v grep|wc -l` -eq 0 ];then
                            echo 'the process 8080 is not exit'
                            break
                    else
                            ps -ef|grep tomcat|grep -v grep|awk '{print $2}'|xargs kill -9
                            echo 'Kill the process'
                    fi
            done
    mkdir  $his_version_path
    if [ -d "$his_version_path" ];then
            echo 'Backup the last deployed version'
            mv $web_source/client_web $his_version_path/
            echo 'Deploying a new version'
            mv $home_path/version/client_web $web_source
            echo 'Start server'
            sh $web_source/../bin/startup.sh
            rm -rf $home_path/version/*
    fi

  • 相关阅读:
    对象属性键值[key]属性问题
    理解 JavaScript 中的 for…of 循环
    vue初学篇----过滤器(filters)
    CSS变量
    SCSS !default默认变量
    vue 集成 NEditor 富文本
    如何在Github上面精准搜索开源项目?
    OSS介绍
    键盘各键对应的编码值(key code)
    网易云音乐歌单生成外链播放器
  • 原文地址:https://www.cnblogs.com/colin2012/p/8610522.html
Copyright © 2011-2022 走看看