转至:https://www.bbsmax.com/A/lk5aB4b4d1/

#!/bin/bash
#date --
#writen lxh
 
dir_war=/home/weblogic/war
dir_app=/servyouapp/weblogic/user_projects/domains/shyznwgl_domain/app
dir_bak=/home/weblogic/backup
 
dir_restart=/servyouapp/weblogic/user_projects/scripts
 
deal()
{
    echo -e "\033[33m-----------------------${i}------------------------------\033[0m"
    echo "[INFO] 部署${i}..."
    echo "[INFO] 备份${i}..."
    [ -f $dir_bak/${i}. ]&&rm -f $dir_bak/${i}.
    [ -f $dir_bak/${i}. ]&&mv $dir_bak/${i}. $dir_bak/${i}.
    [ -f $dir_bak/${i}. ]&&mv $dir_bak/${i}. $dir_bak/${i}.
    [ -f $dir_app/${i} ]&&mv $dir_app/$i $dir_bak/${i}.
    mv $dir_war/$i $dir_app/
    echo "[START...] ${i}重启中..."
 
    sed -i \'s/tail/#tail/g\' $dir_restart/$
    sh $dir_restart/$
    sed -i \'s/#tail/tail/g\' $dir_restart/$
    echo ""
}
 
echo "检查是否有war包更新..."
n1=`ls $dir_war |wc -l`
if [ $n1 -eq  ];then
    echo -e "\033[31m[WRING...] ${dir_war}中无war包!\033[0m"
    exit;
fi
 
echo "war包识别..."
for i in `ls $dir_war`;do
    case $i in
        dzswj-authentication-platform.war)
            deal reshtyrzyz-nw.sh
            ;;
        dzswj-user-manager-platform.war)
            deal reshmhyz-nw.sh
            ;;
        fcsyy-app-nw-web.war)
            deal reshfcsyz-nw.sh
            ;;
        nsqd-nw-web.war)
            deal reshwszyz-nw.sh
            ;;
        nsqd-nw-ws.war)
            deal reshwszyz-nw.sh
            ;;
        wsjs-app-nw-web.war)
            deal reshwsjsyz-nw.sh
            ;;
        wssb-app-nw-web.war)
            deal reshwssbyz-nw.sh
            ;;
        wsz-nw-web.war)
            deal reshxwszyz-nw.sh
            ;;
        *)
            echo -e "\033[31m[WRING...] ${i}包名不匹配,请检查!\033[0m" >>deploy.tmp
            ;;
    esac
done
[ -f deploy.tmp ]&&cat deploy.tmp
[ -f deploy.tmp ]&&rm -f deploy.tmp
echo -e "\033[32m部署完成!请查看相应启动日志。\033[0m"

 

版权声明:本文为my-first-blog-lgz原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/my-first-blog-lgz/p/13936485.html