Wednesday, February 4, 2015

Automatic startup of WLS servers when booting Linux

On the My Oracle Support website you can find the article "RC Initialization Scripts for Starting and Stopping WebLogic Server as a UNIX Daemon [ID 877902.1]".
Here in this post, I will describe an alternative method.
I tested out on a Oracle Linux 6 host machine.
These are the steps that must/can be performed:

(1)
Create for each server within your domain a boot.properties file (My Oracle Support: "How to Start a WebLogic 10.3.x Domain AdminServer Without Interactively Supplying the Username / Password? [ID 980292.1]").


(2)
Login as root


(3)
Navigate to /etc/init.d and create a file wls with this content:
#!/bin/bash
#
# oracle Init file for starting and stopping WLS
#
# chkconfig: 35 80 30
# description: Oracle WLS startup script
# Source function library

. /etc/rc.d/init.d/functions

ORACLE_OWNER="oracle"
DOMAIN_HOME="/opt/oracle/Oracle/Middleware/user_projects/domains/dev_domain"

case "$1" in
start)
echo -n $"Starting WLS:"
su - $ORACLE_OWNER -c "$DOMAIN_HOME/bin/startWebLogic.sh > /dev/null 2>&1 &"
su - $ORACLE_OWNER -c "$DOMAIN_HOME/bin/startManagedWebLogic.sh ManagedServer1 > /dev/null 2>&1 &"
su - $ORACLE_OWNER -c "$DOMAIN_HOME/bin/startManagedWebLogic.sh ManagedServer2 > /dev/null 2>&1 &"
echo "OK"
;;
stop)
echo -n $"Stopping WLS:"
su - $ORACLE_OWNER -c "$DOMAIN_HOME/bin/stopManagedWebLogic.sh ManagedServer1"
su - $ORACLE_OWNER -c "$DOMAIN_HOME/bin/stopManagedWebLogic.sh ManagedServer2"
su - $ORACLE_OWNER -c "$DOMAIN_HOME/bin/stopWebLogic.sh"
echo "OK"
;;
*)
echo $"Usage: $0 {start|stop}"
esac


(4)
In a terminal window, execute these commands:
chmod 750 /etc/init.d/wls
chkconfig --add wls --level 0356

No comments:

Post a Comment