web vieworacle_ownr=obiee # local unix user running obiee. oracle_fmw=/u01/middleware # deployment...

5
#!/bin/bash # # Purpose: Start and stop OBIEE 11g servers including node manager & components # Usage: ob_start_stop_nmgr.sh start|stop|restart|status # # Author: John L Watson/Krishna Malyala # version 2.0 6/20/2013 # ################################################# # These values must be adapted to your environment. ORACLE_OWNR=obiee # Local Unix user running OBIEE ORACLE_FMW=/u01/Middleware # Deployment root directory BIEE_USER=weblogic # BIEE administrator name BIEE_PASSWD=weblogic*** # BIEE administrator password BIEE_DOMAIN=bifoundation_domain # Domain name BIEE_INSTANCE=instance1 # Instance name BIEE_SERVER=bi_server1 # Server name BIEE_MANAGER_URL=obiwan.*.com:7001 # Admin server URL (hostname:port) # These should require no change. WL_PATH=$ORACLE_FMW/wlserver_10.3/server/bin BIEE_PATH=$ORACLE_FMW/user_projects/domains/$BIEE_DOMAIN/bin ORACLE_INSTANCE=$ORACLE_FMW/instances/$BIEE_INSTANCE export ORACLE_INSTANCE NOW=$(date +"%Y%m%d.%H%M") start() { echo "************************************************************************ ********" echo "Starting Admin Server on $(date)" echo "************************************************************************ ********" cd $BIEE_PATH sCmd="./startWebLogic.sh" sCmd="$sCmd -Dweblogic.management.username=$BIEE_USER " sCmd="$sCmd -Dweblogic.management.password=$BIEE_PASSWD" sLog="$BIEE_PATH/WLS$NOW.out" nohup $sCmd > $sLog & wait_for $sLog "Server started in RUNNING mode"

Upload: phamthu

Post on 06-Mar-2018

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Web viewORACLE_OWNR=obiee # Local Unix user running OBIEE. ORACLE_FMW=/u01/Middleware # Deployment root directory. BIEE_USER=weblogic

#!/bin/bash## Purpose: Start and stop OBIEE 11g servers including node manager & components# Usage: ob_start_stop_nmgr.sh start|stop|restart|status## Author: John L Watson/Krishna Malyala# version 2.0 6/20/2013################################################## # These values must be adapted to your environment.ORACLE_OWNR=obiee # Local Unix user running OBIEEORACLE_FMW=/u01/Middleware # Deployment root directoryBIEE_USER=weblogic # BIEE administrator nameBIEE_PASSWD=weblogic*** # BIEE administrator passwordBIEE_DOMAIN=bifoundation_domain # Domain nameBIEE_INSTANCE=instance1 # Instance nameBIEE_SERVER=bi_server1 # Server nameBIEE_MANAGER_URL=obiwan.*.com:7001 # Admin server URL (hostname:port) # These should require no change.WL_PATH=$ORACLE_FMW/wlserver_10.3/server/binBIEE_PATH=$ORACLE_FMW/user_projects/domains/$BIEE_DOMAIN/binORACLE_INSTANCE=$ORACLE_FMW/instances/$BIEE_INSTANCEexport ORACLE_INSTANCENOW=$(date +"%Y%m%d.%H%M") start() { echo "********************************************************************************" echo "Starting Admin Server on $(date)" echo "********************************************************************************" cd $BIEE_PATH sCmd="./startWebLogic.sh" sCmd="$sCmd -Dweblogic.management.username=$BIEE_USER " sCmd="$sCmd -Dweblogic.management.password=$BIEE_PASSWD" sLog="$BIEE_PATH/WLS$NOW.out" nohup $sCmd > $sLog & wait_for $sLog "Server started in RUNNING mode" echo "********************************************************************************" echo "Starting Node Manager " echo "********************************************************************************" nohup "$WL_PATH/startNodeManager.sh" >nod.out & wait_for nod.out "socket listener started on port"

Page 2: Web viewORACLE_OWNR=obiee # Local Unix user running OBIEE. ORACLE_FMW=/u01/Middleware # Deployment root directory. BIEE_USER=weblogic

echo "********************************************************************************" echo "Starting Managed Server $BIEE_SERVER on $(date)" echo "********************************************************************************" cd $BIEE_PATH sCmd="./startManagedWebLogic.sh" sCmd="$sCmd $BIEE_SERVER" sCmd="$sCmd http://$BIEE_MANAGER_URL" sLog="$BIEE_PATH/BIS$NOW.out" nohup $sCmd > $sLog & wait_for $sLog "Server started in RUNNING mode" echo "********************************************************************************" echo "Starting BI components on $(date)" echo "********************************************************************************" cd $ORACLE_INSTANCE/bin ./opmnctl startall }stop() { echo "********************************************************************************" echo "Stopping Managed Server $BIEE_SERVER on $(date)" echo "********************************************************************************" # Get Process IDs for currently running processes PIDs=`ps -ef | grep -v grep | grep $BIEE_DOMAIN | grep $BIEE_SERVER | cut -c10-15` # Shutdown Managed Server via WebLogic Scripts cd $BIEE_PATH #sCmd="./stopManagedWebLogic.sh" #sCmd="$sCmd $BIEE_SERVER" #sCmd="$sCmd t3://$BIEE_MANAGER_URL" #cCmd="$sCmd $BIEE_USER $BIEE_PASSWD" #$sCmd ./stopManagedWebLogic.sh $BIEE_SERVER t3://$BIEE_MANAGER_URL $BIEE_USER $BIEE_PASSWD # Kill any Processes that remain for p in $PIDs; do pkill -TERM -P $p done # Remove Managed Server Lock Files cd $BIEE_PATH cd ../servers/$BIEE_SERVER ext_array="lok DAT"

Page 3: Web viewORACLE_OWNR=obiee # Local Unix user running OBIEE. ORACLE_FMW=/u01/Middleware # Deployment root directory. BIEE_USER=weblogic

for ext in $ext_array; do for f in $( find -name "*.$ext" ); do mv $f $f.$NOW.bck done done echo "********************************************************************************" echo "Stopping Node Manager " echo "********************************************************************************" pkill -TERM -u $ORACLE_OWNR -f "weblogic\\.NodeManager" echo "********************************************************************************" echo "Stopping Admin Server on $(date)" echo "********************************************************************************" # Get Process IDs for currently running processes aPID=`ps -ef | grep -v grep | grep $BIEE_DOMAIN | grep AdminServer | cut -c10-15` wPID=`ps -ef | grep -v grep | grep $BIEE_DOMAIN | grep startWebLogic.sh | cut -c10-15` PIDs=("${aPID[@]}" "${wPID[@]}") # Shutdown WebLogic Server via WebLogic Scripts cd $BIEE_PATH ./stopWebLogic.sh $BIEE_USER $BIEE_PASSWD t3://$BIEE_MANAGER_URL # Kill any Processes that remain for p in $PIDs; do pkill -TERM -P $p done # & Remove AdminServer Lock Files cd $BIEE_PATH cd ../servers/AdminServer ext_array="lok DAT" for ext in $ext_array; do for f in $( find -name "*.$ext" ); do mv $f $f.$NOW.bck done done echo "********************************************************************************" echo "OBIEE stop sequence completed on $(date)"

Page 4: Web viewORACLE_OWNR=obiee # Local Unix user running OBIEE. ORACLE_FMW=/u01/Middleware # Deployment root directory. BIEE_USER=weblogic

echo "********************************************************************************"} wait_for() { res=0 while [[ ! $res -gt 0 ]] do res=$(tail -5 $1 | fgrep -c "$2") sleep 5 done} case "$1" in start) echo "********************************************************************************" echo "Starting Oracle Business Intelligence on $(date)" echo "********************************************************************************" start ;; stop) echo "********************************************************************************" echo "Stopping Oracle Business Intelligence on $(date)" echo "********************************************************************************" stop ;; restart) $0 stop $0 start ;; status) cd $ORACLE_INSTANCE/bin ./opmnctl status ;; *) echo "Usage: $(basename $0) start|stop|restart|status" exit 1esac exit 0

Page 5: Web viewORACLE_OWNR=obiee # Local Unix user running OBIEE. ORACLE_FMW=/u01/Middleware # Deployment root directory. BIEE_USER=weblogic