Linux shell script file for Start/Stop Weblogic Services

 

This time we are sharing a shell script for starting/stopping Weblogic services. This shell script can

  1. Start Weblogic Admin Server (after starting Node Manager)
  2. Once the Admin server started, you can start the forms and reports services using the Admin Console
  3. Unless conflicts, you should able to access the Oracle enterprise manager console as well

Copy the content below in plain text file first, change the extension to .sh and set the execute permissions

 

 

 

 

[sourcecode language=”bash” gutter=”false” wraplines=”true”]
#!/bin/sh

if [ -z "$1" ]; then
echo "You must supply either start or stop command while calling this script! correct usage: weblogic_start_stop.sh start|stop"
exit
fi

bold=`tput bold`
normal=`tput sgr0`

case "$1" in
‘start’)
echo "Starting Management Node & Weblogic Server 10.3.6"

echo "Starting NodeManager"

nohup $WLS_HOME/server/bin/startNodeManager.sh > /dev/null 2>&1 &

sleep 10

output=`ps -ef | grep -i nodemanager.javahome | grep -v grep | awk {‘print $2’} | head -1`

set $output

pid=$1

echo "Weblogic NodeManager Service was started with process id : ${bold}$pid${normal}"

echo "Starting WebLogic Domain"

nohup $MW_HOME/user_projects/domains/ClassicDomain/bin/startWebLogic.sh > /dev/null 2>&1 &

# Sleep until exiting
sleep 60
echo "All done, exiting"
exit
esac

################################Stopping the services##################################

case "$1" in
‘stop’)
echo "Stopping Weblogic Server & Node Manager"

nohup $MW_HOME/user_projects/domains/ClassicDomain/bin/stopWebLogic.sh > /dev/null 2>&1 &

sleep 30

# echo "Killing Nodemanager process now"

output=`ps -ef | grep -i nodemanager.javahome | grep -v grep | awk {‘print $2’} | head -1`
set $output
pid=$1
echo "Killing Weblogic NodeManager Service Process : ${bold}$pid${normal}"

kill -9 `ps -ef | grep -i nodemanager.javahome | grep -v grep | awk {‘print $2’} | head -1`

echo "All done, exiting"
exit
esac

[/sourcecode]

 

 

 

 

If you have queries, please ask them using comments section.

for Windows7bugs

rajesh

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.