weblogic补丁安装脚本 CVE-2018-2893

最近一直再装weblogic补丁,不厌其烦,做此脚本,一键装补丁。

不同版本修改对应版本补丁名即可。

 

一、weblogic10.3.6
    cd $ORACLE_HOME
    需修改.../utils/bsu/bsu.sh 中:1、内存大小,2、patch-client.jar改为绝对路径
    JAVA_HOME="/home/weblogic/jdk1.6.0_45"
    MEM_ARGS="-Xms2048m -Xmx2048m"
    "$JAVA_HOME/bin/java" ${MEM_ARGS} -jar /home/weblogic/utils/bsu/patch-client.jar $*

 

#!/bin/bash
rm patch-catalog.xml README.txt
unzip p27919965_1036_Generic.zip
sleep 2
mv patch-catalog_26112.xml patch-catalog.xml

# find oldPatchid config
mkdir cache_dir
cp patch-catalog.xml ./cache_dir

echo "======Next is version of weblogic==============="
sh ../bsu.sh -prod_dir=../../../wlserver_10.3/ -status=applied -verbose -view > version
cat version

grep "Patch ID" version > restxt
>patchId
flag=0
cat restxt | while read line
do
#    echo $line
    echo $line | awk '{print $3}' >> patchId
    flag=$(($flag + 1))
done

echo "=======Next is Patch ID===================="
cat patchId
#next is remove Patch ID
rmflag=1
cat patchId | while read line
do
    sh ../bsu.sh -patchlist=$line -prod_dir=../../../wlserver_10.3 -verbose -remove
    echo "$line removed!!!"
    rmflag=$?
done

echo "-------------oldPatch ID removed suecceed!!!-------------"
echo "======Next is version of weblogic==============="
sh ../bsu.sh -prod_dir=../../../wlserver_10.3/ -status=applied -verbose -view

echo "=======Next is install===================="
#if [ 0 -eq $rmflag ]
#then
#    echo "-------------oldPatch ID removed suecceed!!!-------------"
    sh ../bsu.sh -install -patch_download_dir=./ -patchlist=B47X -prod_dir=../../../wlserver_10.3
    inflag=$?
    if [ 0 -eq $inflag ]
    then
        echo "------------new Patch ID install suecceed!!!---------------"
        echo "------Install over!!!-----------"
        echo "======Next is version of weblogic==============="
        sh ../bsu.sh -prod_dir=../../../wlserver_10.3/ -status=applied -verbose -view
    else
        echo "------------new Patch ID install failed!!!---------------"
        sh ../bsu.sh -prod_dir=../../../wlserver_10.3/ -status=applied -verbose -view
    fi
#else
#    echo "-------------oldPatch ID remove failed!!!-------------"
#    sh ../bsu.sh -prod_dir=../../../wlserver_10.3/ -status=applied -verbose -view
#fi

 

二、weblogic12.1.3
    cd $Oracle_Home/OPatch
    将12c安装包上传至目录,脚本如下:

 

export ORACLE_HOME=/home/weblogic/weblogic1213(改为自己服务器的weblogic安装路径)
unzip
p27919943_121300_Generic.zip echo "========next is inventory======" ./opatch lsinventory echo "========next is apply=====" ./opatch apply ./27919943/ echo "========next is inventory======" ./opatch lsinventory

 

转载于:https://www.cnblogs.com/daxman/p/9372661.html

你可能感兴趣的:(weblogic补丁安装脚本 CVE-2018-2893)