Tuesday, August 28, 2012

script to shutdown/start Weblogic components(oid, discoverer...)

startup:
# Set environment variables

MW_HOME=/oracle/FMW11
DOMAIN_HOME=$MW_HOME/user_projects/domains/Forms
ORACLE_INSTANCE=$MW_HOME/instances/forms
export MW_HOME DOMAIN_HOME ORACLE_INSTANCE

# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# WEBLOGIC SERVER DOMAIN STARTUP
#
# If required, start up WebLogic Domain Servers
# This section can be commented if you working with a FMW 11g AS Instance
# (for example Web Tier) which has no dependency on a WebLogic Domain
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

# The following files need to exist in order to startup automatically
# $DOMAIN_HOME/servers/AdminServer/security/boot.properties
# $DOMAIN_HOME/servers/<managed server name>/security/boot.properties
# Each file must contain:
# username=weblogic
# password= <= This password is automatically obfuscated the next time the
# Weblogic Server is started up
#

# Optionally start up the WebLogic Domain Admin Server
# The Admin Server does not need to be up and running for the
# individual managed servers to start up
# However, if Admin Server is not up and running, Fusion Middleware Control (EM)
# and WebLogic Admin Console will not function.

echo "Starting up the AdminServer ..."

# Note although we redirect stdout and stderr to /dev/null they are redirected to
# the AdminServer.log

nohup $DOMAIN_HOME/startWebLogic.sh >/dev/null 2>/dev/null &

#
# Wait for some seconds to make sure the AdminServer is listening
# before we attempt to start up the individual managed servers.
# The managed servers will need to connect to the Admin Server in order
# to for the EM applications to be able to "see" these instances

#
sleep 120

#
# In this example we are starting WLS_FORMS and WLS_REPORTS,
# just replace these names by the managed servers corresponding
# to your installation
# e.g. wls_ods1
#
# The example also assumes the AdminServer is listening on port 7001,
# replace the port in "t3://localhost:7001/" if AdminServer is
# listening on a different port
# Replace "localhost" by the actual hostname where the AdminServer is running. e.g. in a cluster
# environment
#

echo "Starting up WLS_FORMS ..."
nohup $DOMAIN_HOME/bin/startManagedWebLogic.sh WLS_FORMS t3://localhost:7001/ >/dev/null 2>/dev/null &

echo "Starting up WLS_REPORTS ..."
nohup $DOMAIN_HOME/bin/startManagedWebLogic.sh WLS_REPORTS t3://localhost:7001/ >/dev/null 2>/dev/null &


# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# SYSTEM COMPONENTS STARTUP
# If required, start up OPMN managed processes
# This section can be commented if you working with a FMW 11g AS Instance
# (for example SOA / WebCenter) which has no dependency on system components
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

echo "Starting up the OPMN managed components ..."
$ORACLE_INSTANCE/bin/opmnctl startall



Shutdown:
# Set environment variables

MW_HOME=/oracle/FMW11
DOMAIN_HOME=$MW_HOME/user_projects/domains/Forms
ORACLE_INSTANCE=$MW_HOME/instances/forms
export MW_HOME DOMAIN_HOME ORACLE_INSTANCE

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# SYSTEM COMPONENTS STOP
# If required, stop the OPMN managed processes
# This section can be commented if you working with a FMW 11g AS Instance
# (for example SOA / WebCenter) which has no dependency on system components
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

echo "Stopping the OPMN managed components ..."
$ORACLE_INSTANCE/bin/opmnctl stopall


# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# WEBLOGIC SERVER DOMAIN STOP
#
# If required, stop the WebLogic Domain Servers
# This section can be commented if you working with a FMW 11g AS Instance
# (for example Web Tier) which has no dependency on a WebLogic Domain
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

# The following files need to exist in order to stop automatically
# $DOMAIN_HOME/servers/AdminServer/security/boot.properties
# $DOMAIN_HOME/servers/<managed server name>/security/boot.properties
# Each file must contain:
# username=weblogic
# password= <= This password is automatically obfuscated the next time the
# Weblogic Server is started up
#


#
# In this example we are stopping WLS_FORMS and WLS_REPORTS,
# just replace these names by the managed servers
# corresponding to your installation
# e.g. wls_ods1
# Note: The Admin Server must be up and running!
# The example also assumes the AdminServer is listening on port 7001,
# replace the port in "t3://localhost:7001/" if AdminServer is
# listening on a different port
# Replace "localhost" by the actual hostname where the AdminServer is running. e.g. in a cluster
# environment
#

echo "Shutting down WLS_FORMS ..."
nohup $DOMAIN_HOME/bin/stopManagedWebLogic.sh WLS_FORMS t3://localhost:7001/ >/dev/null 2>/dev/null &
# In busy environments you may want to a different command to perform a forceful shutdown instead stopManagedWebLogic.sh
# Note the preferred option is stopManagedWebLogic.sh as it performs a graceful shutdown (i.e. wait for current requests to finish).
# This is the command to run instead of stopManagedWebLogic.sh
# java weblogic.Admin -url localhost:7001 -username weblogic -password welcome1 FORCESHUTDOWN WLS_FORMS
#
sleep 60
echo "Shutting down WLS_REPORTS ..."
nohup $DOMAIN_HOME/bin/stopManagedWebLogic.sh WLS_REPORTS t3://localhost:7001/ >/dev/null 2>/dev/null &

#
# We wait 120 seconds before stopping the AdminServer to allow enough time for WLS_FORMS and WLS_REPORTS to shutdown
# If you see 120 seconds may not be enough just change the sleep 120 by a bigger value like sleep 300


sleep 120

# Stop the WebLogic Domain Admin Server

echo "Shutting down the AdminServer ..."

# Note although we redirect stdout and stderr to /dev/null they are redirected
# to the AdminServer.log

nohup $DOMAIN_HOME/stopWebLogic.sh >/dev/null 2>/dev/null &

No comments:

Post a Comment