Feb 242015
 Posted by on February 24, 2015 at 9:54 am Application Servers, Automation, bash, Java App Servers, Oracle/BEA WebLogic Tagged with: ,  Add comments
Oracle Weblogic Server

Below shell script can be used to start the weblogic nodemanager. This script can be scheduled in cron tab to start nodemanager weblogic servers. It takes one input i.e weblogic installation home location to start the nodemanager.

Incase the nodemanager is already running it will not start the nodemanager again. This script was made available as part of life cycle automation task. you can search this website for more automation scripts like this.

#scriptfile /opt/Middleware
status=`ps -eaf | grep "weblogic.NodeManager" | grep -v grep | awk -F' ' '{ print $2 }' | wc -l`
if [ "${status}" == 0 ]; then
echo "`date` :Starting Weblogic NodeManager...";
nohup ${WL_INSTALL_HOME}/wlserver_10.3/server/bin/startNodeManager.sh > ${TFILE} 2>&1 &
echo "`date` :NodeManager is already RUNNING..";
exit 0;
if [ "$?" != 0 ]; then
echo "Command Failed To Execute Properly";
exit 1;
#while true; do
export a="0";
while [ $a -lt 60 ]; do
count=`cat ${TFILE} | grep "socket listener started on port" | wc -l`
if [ "${count}" -gt 0 ]; then
echo "NodeManager Started...";
rm -f ${TFILE}
exit 0;
echo "Waiting For NodeManager To Start...";
a=`expr $a + 1`
sleep 5s;
echo "Some Issue Happened While Starting The NodeManager Please Investigate Log File ${TFILE}";
exit 1;

Output incase nodemanager is already running.

# ./node.sh /opt/Middleware/
Wed Feb 25 02:18:23 CST 2015 :NodeManager is already RUNNING..

Output of script when node manager is down:

# ./node.sh /opt/Middleware/
Wed Feb 25 02:19:39 CST 2015 :Starting Weblogic NodeManager...
Waiting For NodeManager To Start...
Waiting For NodeManager To Start...
NodeManager Started...

Similarly for stopping nodemanager weblogic you can use below script:

This script does not take any argument and kills any running weblogic.NodeManager process.

status=`ps -eaf | grep "weblogic.NodeManager" | grep -v grep | awk -F' ' '{ print $2 }' | wc -l`
if [ "${status}" -gt 0 ]; then
kill -9 `ps -eaf | grep "weblogic.NodeManager" | grep -v grep | awk -F' ' '{ print $2 }'`
echo "`date` :Node Manager Seems To Be already in stopped state.";
echo "`date` :Skipping To Stop The NodeManager Again.";
exit 0;
if [ "$?" == 0 ]; then
echo "`date` :Node Manager Successfully killed.";
exit 0;
echo "`date` :Node Manager Failed To Stop.";
exit 1;

Note: All above scripts are tested in environments which contains single weblogic server nodemanager, incase you have multiple node managers in the same machine then you have to update the script with narrowed down grep statements.
you can get more weblogic scripts here

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

  One Response to “Shell script to start nodemanager weblogic”

  1. Thanks for the nice scripts

Leave a Reply

Show Buttons
Hide Buttons