Wednesday, August 8, 2012

Weblogic Start/stop/status Scripts


Weblogic Startup/Shutdown Scripts UNIX

Start Weblogic Script

1. Create a file name Start_Evn_Weblogic.sh
2. Edit the parameters according to the environment
#!/bin/ksh

if [ $(whoami) != "<userid>" ]  # check the userid who should be authorised to start the script
then
echo "You dont have permission to start this service."
else
netstat -na| grep <AdminPort> | grep -v grep  1>/dev/null 2>&1

if [ $? -eq 0 ];
then
                echo "Weblogic Evn domain is already Running. No action taken.";
else
                echo "Weblogic Env Service is Down. Starting it now.";
                cd /oracle/app/product/fmw/user_projects/domains/Domainname/bin
                nohup ./startWebLogic.sh &
                sleep 30
                nohup ./startManagedWebLogic.sh <ManagedServer Name> t3://<Adminhostname>:<AdminPort>&
fi
fi;

-----------------------------------------------------------------------------------------------------------

Stop Weblogic Script

1. Create a file name Stop_Evn_Weblogic.sh
2. Edit the parameters according to the Environment

#!/bin/ksh

netstat -na| grep <AdminPort> | grep -v grep  1>/dev/null 2>&1

if [ $? -eq 0 ];
        then
                echo "Weblogic ENV Domain is Running. Stoping the service now.";
                cd /oracle/app/product/fmw/user_projects/domains/DomainName/bin
                nohup ./stopManagedWebLogic.sh <ManagedServer Name> t3://<AdminserverHost>:<AdminPort> &
                echo "Stopping managed server now.....wait for 30 secs"
                sleep 30
                nohup ./stopWebLogic.sh &
                echo "Stopped Managed server, now stopping Admin server"
        else
                echo "Weblogic EVN Domain is NOT Running. No action taken.";
fi;

--------------------------------------------------------------------------------------------------------

Checking the Weblgic Server status


1. Create a ServiceCheckWeblogic.sh file
2. Edit the parameters according to the Environment


netstat -na | grep <AdminPort> | grep -v grep  1>/dev/null 2>&1

if [ $? -eq 0 ];
        then
                echo
                echo "Weblogic Domain is Running.";
                echo
        else
                echo
                echo "Weblogic Domain is Down.";
                echo
fi;

No comments:

Post a Comment