Tuesday, May 31, 2011

Linux IDM Auto-start for OID SSO WebLogic

So you have been reading my other post about OID + SSO setup and you got everything running, but now you need a way to auto-start everything from Linux right? Make sure you have a properly configured boot.properties under WL_HOME/security and cut-and-paste the rest to tailor your needs and drop into the desired rc.d folder for the target run-time. Don't forget to enable the auto-start within /etc/oratab for the database!

#!/bin/sh
# description: webLogic adminServer and managedServer start script
#
WLS_DOMAIN=IDMDomain
WLS_BASE=/app/infra/wl-home
WLS_HOME=${WLS_BASE}/user_projects/domains/$WLS_DOMAIN
WLS_NODE_HOME=${WLS_BASE}/wlserver/server/bin
WLS_OWNER=oracle
WLS_ADMIN_PORT=7001
WLS_ADMIN_LOGIN=weblogic
WLS_ADMIN_PWD=<password>
WLS_LOG_START=${WLS_BASE}/logs/start.`date '+%d%m%y'`.log
WLS_LOG_STOP=${WLS_BASE}/logs/stop.`date '+%d%m%y'`.log
WLS_MANAGED_SERVER1=wls_ods1
WLS_IDM_HOME=${WLS_BASE}/Oracle_IDM
DB_HOME=/app/infra/db/product/11.2.0/dbhome_1
SSO_HOME=/app/infra/sso-home
export ORACLE_SID=infradev
export PATH=/bin:/usr/bin
export ORACLE_HOME_LISTNER=${DB_HOME}
export ORACLE_INSTANCE=/app/infra/wl-home/asinst
if [ ! -f $WLS_HOME/startWebLogic.sh ]
then
    echo "WebLogic startup: cannot $WLS_HOME/startWebLogic.sh "
    exit
fi
startDb(){
export ORACLE_HOME=${DB_HOME}
#start DB & Listener
su $WLS_OWNER -c "${DB_HOME}/bin/lsnrctl start &"
su $WLS_OWNER -c "${DB_HOME}/bin/dbstart &"
sleep 60
}
stopDb(){
#Stop database
export ORACLE_HOME=${DB_HOME}
su $WLS_OWNER -c "${DB_HOME}/bin/lsnrctl stop &"
su $WLS_OWNER -c "${DB_HOME}/bin/dbshut &"
sleep 60
}

startWeblogic()
{
#start node manager
su $WLS_OWNER -c "nohup $WLS_NODE_HOME/startNodeManager.sh > $WLS_LOG_START 2>&1 &"
sleep 10
#start admin server
su $WLS_OWNER -c "nohup $WLS_HOME/startWebLogic.sh >> $WLS_LOG_START 2>&1 &"
sleep 10
#start OID & OHS proccess
export ORACLE_HOME=${WLS_IDM_HOME}
su $WLS_OWNER -c "nohup $WLS_IDM_HOME/opmn/bin/opmnctl startall &"
sleep 30
#Start SSO server
export ORACLE_HOME=${SSO_HOME}
su $WLS_OWNER -c "nohup $SSO_HOME/opmn/bin/opmnctl startall &"
sleep 30
#Start the rest of the IDM proccess
su $WLS_OWNER -c "nohup $WLS_HOME/bin/startManagedWebLogic.sh $WLS_MANAGED_SERVER1 >> $WLS_LOG_START 2>&1 &"
sleep 10
}
stopWeblogic()
{
#Stop node manager
su $WLS_OWNER -c "nohup $WLS_NODE_HOME/stopNodeManager.sh > ${WLS_LOG_STOP} 2>&1 &"
sleep 10
#Stop managed nodes
su $WLS_OWNER -c "nohup $WLS_HOME/bin/stopManagedWebLogic.sh $WLS_MANAGED_SERVER1 t3://localhost:$WLS_ADMIN_PORT >> ${WLS_LOG_STOP} 2>&1 &"
sleep 10
#stop SSO server
export ORACLE_HOME=${SSO_HOME}
su $WLS_OWNER -c "nohup $SSO_HOME/opmn/bin/opmnctl stopall &"
sleep 30
#stop OID & OHS proccess
su $WLS_OWNER -c "nohup $WLS_IDM_HOME/opmn/bin/opmnctl stopall &"
sleep 30
#Stop admin server
su $WLS_OWNER -c "nohup $WLS_HOME/bin/stopWebLogic.sh >> ${WLS_LOG_STOP} 2>&1 &"
sleep 10
}
case "$1" in
    'start')
 startDb
        startWeblogic
        ;;
    'stop')
        stopWeblogic
 stopDb
        ;;
    'restart')
        stopWeblogic
        startWeblogic
        ;;
    *)
        echo "Usage: $0 start|stop|restart"
        exit 1
        ;;
esac

No comments:

Post a Comment