As in my previous blog post I share the concept of starting and stopping nodemanager. In this blog post I am going to show you how you can start and stop weblogic admin server and managed server using admin server connection.
Start scripts for admin server and managed server
Well the basic logic to start admin and managed server is as:
Start scripts for admin server and managed server
Well the basic logic to start admin and managed server is as:
- Start the admin server using ./startWeblogic.sh script stored at the domain directory.
- check for the admin server status is running or not by using same way as did for nodemanager in this post. But here we check for the string "RUNNING"
- After admin started we invoke to start all the managed server cluster (all the server in a cluster will automatically start).
Here is the script:
rm -rf *_Server.out AdminServer.out
tfile="AdminServer.out"
cd $DOMAIN_HOME
nohup ./startWebLogic.sh > AdminServer.out &
AdminStatus="STOP"
while [ "$AdminStatus" = "STOP" ]; do
echo $tfile
count=$(cat $tfile | grep "RUNNING" | wc -l)
echo "The value of count is ${count}"
if [[ "$count" -gt 0 ]]; then
echo "AdminServer Started..."
AdminStatus="RUNNING"
nohup $WEBLOGIC_HOME/common/bin/wlst.sh startOSB.sh > OSB_Server.out &
nohup $WEBLOGIC_HOME/common/bin/wlst.sh startSOA.sh > SOA_Server.out &
nohup $WEBLOGIC_HOME/common/bin/wlst.sh startWSM.sh > WSM_Server.out &
rm -f $tfile
exit 0
else
echo "Waiting For AdminServer To Start..."
fi
sleep 5s
done
echo "Please check ${tfile} log file for more issues"
exit 1
In the above scripts I am calling three more scripts which are used to start the managed server cluster.
startOSB.sh
Content of the script is as follow:
connect('weblogic', 'welcome1', 't3://adminhostname:port')
start('bpm_osb_cluster','Cluster')
disconnect()
startSOA.sh
Content of the script is as follow:
connect('weblogic', 'Oracle123', 't3://adminhostname:port')
start('bpm_soa_cluster','Cluster')
disconnect()
startWSM.sh
Content of the script is as follow:
connect('weblogic', 'Oracle123', 't3://adminhostname:port')
start('bpm_wsm_cluster','Cluster')
disconnect()
Note: you can start the server instead of start cluster, refer this documentation
Stop scripts for admin and managed server
For stopping managed server scripts first connect to the nodemanager and use the nmkill() method to kill the managed server
nmConnect('weblogic', 'Oracle123', 'prdbpmn01.ebsafrica.com', '5556', 'BPMDomain', '/u02/oracle/config/domains/BPMDomain','ssl')
nmKill('wls_wsm1')
nmKill('wls_osb1')
nmKill('wls_soa1')
nmDisconnect()
exit()
so you have to kill each server because there is no such method available to stop the cluster.
After that stop the admin server using this script.
nohup sh /u01/oracle/config/domains/BPMDomain/bin/stopWebLogic.sh &