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

  • 相关阅读:
    sqli-labs Less29-Less31
    sqli-labs Less23-Less28a
    sqli-labs Less20-Less22
    sqli-labs Less17--Less19
    sqli-labs Less13-Less16
    为什么选择centos,而不是Dibian、Ubuntu【转】
    sublime 安装常用插件
    Linux常用命令
    在UEFI下安装windows和Ubuntu双系统目前不可行
    nginx 环境搭建(基于linux)
  • 原文地址:https://www.cnblogs.com/colin2012/p/8610522.html
Copyright © 2011-2022 走看看