weblogic部署脚本

#!/bin/bash
#date 2016-07-12
#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 "33[33m-----------------------${i}------------------------------33[0m"
    echo "[INFO] 部署${i}..."
    echo "[INFO] 备份${i}..."
    [ -f $dir_bak/${i}.03 ]&&rm -f $dir_bak/${i}.03
    [ -f $dir_bak/${i}.02 ]&&mv $dir_bak/${i}.02 $dir_bak/${i}.03
    [ -f $dir_bak/${i}.01 ]&&mv $dir_bak/${i}.01 $dir_bak/${i}.02
    [ -f $dir_app/${i} ]&&mv $dir_app/$i $dir_bak/${i}.01
    mv $dir_war/$i $dir_app/
    echo "[START...] ${i}重启中..."
    
    sed -i 's/tail/#tail/g' $dir_restart/$1
    sh $dir_restart/$1
    sed -i 's/#tail/tail/g' $dir_restart/$1
    echo ""
}

echo "检查是否有war包更新..."
n1=`ls $dir_war |wc -l`
if [ $n1 -eq 0 ];then
    echo -e "33[31m[WRING...] ${dir_war}中无war包!33[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 "33[31m[WRING...] ${i}包名不匹配,请检查!33[0m" >>deploy.tmp
            ;;
    esac
done
[ -f deploy.tmp ]&&cat deploy.tmp
[ -f deploy.tmp ]&&rm -f deploy.tmp
echo -e "33[32m部署完成!请查看相应启动日志。33[0m"
原文地址:https://www.cnblogs.com/rohero/p/5667164.html