Shell Script to Start and Stop Weblogic Services
In this post, I am sharing the script to stop and restart weblogic services. Please make sure boot.properties file is present and updated with correct username and password.
Note: The port number used here for managed server stop/start is the Admin Server port number(7082)
1) Create an Environment File
$ cat /home/appweb/bin/HS/12c_wls.env
export USR=weblogic
export PASS=webl0gic
export MW_HOME=/u01/oracle/product/Middleware/12.2.1
export WL_HOME=/u01/oracle/product/Middleware/12.2.1/wlserver
export DOMAIN_HOME=/u01/oracle/product/Middleware/12.2.1/user_projects/domains/test_domain
export PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin
2) Create a Start Script
$ cat new_weblogic_Start.sh
. /home/appweb/bin/HS/12c_wls.env
$WL_HOME/server/bin/setWLSEnv.sh
$DOMAIN_HOME/bin/setDomainEnv.sh
echo "Starting Node Manager"
$DOMAIN_HOME/bin/startNodeManager.sh > $MW_HOME/start_stop_logs/nodeManager.out 2>&1 &
echo ""
sleep 30
# Start WLS Admin Server
echo "****************************************************"
echo "Starting WLS Admin Server. Please wait for 2 minutes"
echo "****************************************************"
$DOMAIN_HOME/startWebLogic.sh > $MW_HOME/start_stop_logs/start_wls_admin_server.log &
sleep 120
# Start WLS managed server:
echo "******************************************************"
echo "Starting WLS Managed Servers. Please wait for 2 minutes"
echo "******************************************************"
$DOMAIN_HOME/bin/startManagedWebLogic.sh WLS_MNG_SERVER t3://10.1.10.1:7082 > $MW_HOME/start_stop_logs/start_managed_server_forms.log &
sleep 120
3) Create a Stop Script
$ cat new_weblogic_stop.sh
. /home/appweb/bin/HS/12c_wls.env
$WL_HOME/server/bin/setWLSEnv.sh
$DOMAIN_HOME/bin/setDomainEnv.sh
echo "********************************************************"
echo "Stopping WLS Managed Servers. Please wait for 2 minutes."
echo "********************************************************"
$DOMAIN_HOME/bin/stopManagedWebLogic.sh WLS_MNG_SERVER t3://10.1.10.1:7082 $USR $PASS > $MW_HOME/start_stop_logs/stop_managed_server_forms.log &
sleep 120
# Stop WLS Admin Server
echo "****************************************************"
echo "Stopping WLS Admin Server. Please wait for 2 minutes"
echo "****************************************************"
$DOMAIN_HOME/bin/stopWebLogic.sh
sleep 120
echo "Stopping Node Manager"
$DOMAIN_HOME/bin/stopNodeManager.sh &
sleep 40
Now the script is ready to be used.
Note: In Place of t3://10.1.10.1:7082 you can also use t3://<hostname>.<domain>:<admin_Server_port>
Post a Comment
Post a Comment