Bash script for installing WebLogic Server PSU patches via BSU

Peter Lorenzen
17/09-2013

Patching WebLogic is necessary but not fun. To help out I have created a simple Bash script for installing CPU/PSU patches.

For information about CPU, PSU and SPU patches check this post.

The script is using BEA Smart Update so it is for WebLogic Server 12.1.1 and older. WebLogic Server 12.1.2 has switched from BSU to OPatch.

#!/bin/bash
# ---------------------------------------------------------------------------
# cpuPatch.sh
# Peter Lorenzen
# Version 0.9
# ---------------------------------------------------------------------------

MW_HOME="/u01/app/oracle/product/fmw"
PATCH_FILE="p16619891_1036_Generic.zip"
PATCH_TO_REMOVE="D33T"

echo "################################################################################"
echo "Empty cache_dir"
echo "################################################################################"
rm -f ${MW_HOME}/utils/bsu/cache_dir/*

echo "################################################################################"
echo "Download patch file"
echo "################################################################################"
wget http://patchrepo/weblogic/${PATCH_FILE}
unzip ${PATCH_FILE}

PATCH=`ls *.jar | cut -d'.' --complement -f2-`
CATALOG=`ls patch-catalog*.xml`

echo "################################################################################"
echo "Patch"
echo "################################################################################"
echo "PATCH=$PATCH"
echo "CATALOG=$CATALOG"

cp ${PATCH}.jar ${MW_HOME}/utils/bsu/cache_dir/.
cp ${CATALOG} ${MW_HOME}/utils/bsu/cache_dir/patch-catalog.xml

echo "################################################################################"
echo "List cache_dir"
echo "################################################################################"
ls -la ${MW_HOME}/utils/bsu/cache_dir/${PATCH}.jar
ls -la ${MW_HOME}/utils/bsu/cache_dir/patch-catalog.xml

cd ${MW_HOME}/utils/bsu
#./bsu.sh -view -status=applied -prod_dir=${MW_HOME}/wlserver_10.3

if [ -n "$PATCH_TO_REMOVE" ]; then
  ${MW_HOME}/utils/bsu/bsu.sh -remove -prod_dir=${MW_HOME}/wlserver_10.3 -patchlist=${PATCH_TO_REMOVE} -verbose
fi

${MW_HOME}/utils/bsu/bsu.sh -prod_dir=${MW_HOME}/wlserver_10.3 -patchlist=${PATCH} -verbose -install

. ${MW_HOME}/wlserver_10.3/server/bin/setWLSEnv.sh
java weblogic.version

cd --

Leave a Comment

Previous post:

Next post: