Mar 122015
 Posted by on March 12, 2015 at 8:34 pm Application Servers, Oracle/BEA WebLogic Tagged with: ,  Add comments
Oracle Weblogic Server

Starting a weblogic server is very easy using the Oracle provided default scripts to manage lifecycle. There are many articles on the life cycle management of weblogic servers are written in For example:

wlst script example to manage weblogic server – TechPaste

wlst script example to start, stop and run as service – TechPaste

WLST script to deploy applications in Weblogic – TechPaste

I am again writing one more script as the requirement was to start weblogic server and monitor its status to make sure its up and running before executing other scripts to start the other managed servers and do deployments, etc. So below script is made keeping this requirement of checking the status of weblogic server before exiting or reporting something has failed during start weblogic server process. Please find the script below:

if [[ $# -lt 6 ]] ; then
 echo "Wrong number of arguments..."
 echo "Usage:"
 echo "./ Domain_Home_Loc Server_Name Admin_Server_t3URL UserName Password weblogic.jar_location";
 exit 0
export TFILE=`echo /tmp/nohup.$$.tmp`
status=`java -cp ${WL_JAR_LOC} weblogic.Admin -url ${ADMIN_URL} GETSTATE ${MANAGE_SERVER_NAME} -username ${USER_NAME} -password ${PASSWORD} | awk '{print $6}'`
if [[ "$status" == "SHUTDOWN" ]]; then
elif [[ "$status" == "RUNNING" ]]; then
echo -e "`date` :No Need To Start The Server ${MANAGE_SERVER_NAME} Again.";
echo -e "`date` :Server ${MANAGE_SERVER_NAME} is already in RUNNING state.";
exit 0;
echo -e "`date` :Server ${MANAGE_SERVER_NAME} is in $status state.Not able to start";
exit 0;
if [ "$?" != 0 ]; then
echo "`date` :Command Failed To Execute Properly";
exit 1;
#while true; do
export a="0";
while [ $a -lt 60 ]; do
status=`java -cp ${WL_JAR_LOC} weblogic.Admin -url ${ADMIN_URL} GETSTATE ${MANAGE_SERVER_NAME} -username ${USER_NAME} -password ${PASSWORD} | awk '{print $6}'`
if [ "$status" == "RUNNING" ]; then
echo "`date` :Server Started in RUNNING mode...";
rm -f ${TFILE};
exit 0;
 echo "`date` :Server State : ${status}...";
 a=`expr $a + 1`
sleep 5s;
echo "`date` :Some Issue Encountered While Starting The Server Please Investigate Log ${TFILE}.";
exit 1;

The above script takes below arguments to successfully run. You can hard code the values if you don’t want it to be generic and want to use the script for a specific environment only.

./ /opt/Middleware/user_projects/domains/my_domain My_Server1 t3://techpasteadmin:7001 weblogic weblogic123 /opt/Middleware/wlserver_10.3/server/lib/weblogic.jar


Sample Outputs:

1. Usage:

start weblogic admin server

2. Run Output:

start weblogic server


start weblogic server run output

The above script assumes you have the AdminServer up and running with t3 protocol already and running the script from the servers machine itself.

© Incase of any copyright infringements please check copyrights page for faster resolutions.

  One Response to “Script to start weblogic server”

  1. thank you very much for this script
    can we make a loop to start Adminserver and all managed servers?

Leave a Reply

Show Buttons
Hide Buttons