Wednesday Aug 17, 2016

Bash script to deploy webapp to Weblogic server domain via WLST

I wrote a bash script to deploy a war file to ALL managed servers in a Weblogic domain. You should be able to modify it to work for your needs.

#!/bin/bash HOST_NAME=${1-localhost} HOST_USER=${2-weblogic} HOST_PASS=${3-welcome1} HOST_PORT=${4-7001} JAVA_BIN="/usr/bin/java" SCRIPT_HOME="$(dirname $(readlink -f $0))" WL_JAR="${SCRIPT_HOME}/middleware/wlserver_10.3/server/lib/weblogic.jar" JAM_JAR="myapp.war" function getServerList() { WLST_SERVER_LIST=$(${JAVA_BIN} -cp ${WL_JAR} weblogic.WLST <<EOF connect("${HOST_USER}", "${HOST_PASS}", "t3://${HOST_NAME}:${HOST_PORT}") cd('Servers') ls('a') EOF ) SERVER_LIST="" while read -r CURR_LINE; do if [[ ${CURR_LINE} =~ drw-* ]] then SERVER_LIST+=$(printf ${CURR_LINE#*drw-},) fi done <<< "${WLST_SERVER_LIST}" SERVER_LIST=${SERVER_LIST%,*} #echo $SERVER_LIST } function agentDeployer() { ${JAVA_BIN} -cp ${WL_JAR} weblogic.Deployer -adminurl t3://${HOST_NAME}:${HOST_PORT} -user ${HOST_USER} -password ${HOST_PASS} -targets ${SERVER_LIST} -deploy -upload ${JAM_JAR} } echo "Deploying" getServerList agentDeployer
 
About

Latest information on Oracle Enterprise Manager and Oracle Management Cloud.

Related Blogs




Search


Archives
« March 2017
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
       
Today