On linux, starting OBIEE requires to start
- Weblogic Server Admin Server
- Weblogic Server Node Manager
- Weblogic Managed Server
- Oracle Instance
All of the servers have to be running before starting the others. Looking at the log waiting
for the running state to know when to start another service is a painful and time consuming task. So I wrote a little script. Laziness is sometimes a good thing :)
All you have to do is to modify the configuration variables section with your own values.
Enjoy !
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
#!/bin/bash ########################################### # Copyright (C) 2009 Patrick Lafontaine # Contact: lafontaine.patrick@gmail.com # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ############################################ # Configuration variables # environment specific values.. ############################################ MW_HOME=/path/to/OracleBI DOMAIN_HOME=$MW_HOME/user_projects/domains/domain WL_HOME=$MW_HOME/wlserver_10.3 ORACLE_INSTANCE=$MW_HOME/instances/instance1 weblogicUser='WEBLOGIC' weblogicPassword='YOUR_PASSWORD' weblogicManagedServerName='bi_server' weblogicAdminURL='t3://HOSTNAME:7001' weblogicScriptPath=$DOMAIN_HOME/bin/ weblogicTimeoutError=240 # maximum time in second before raising an error while starting weblogic # To kill the node manager, we need the path of its subprocess... NodeManagerSubProcess=$MW_HOME/Oracle_BI/jdk/bin/java ########################################### # Build the command lines with parameters for each script ########################################### # Weblogic weblogicScriptStart="nohup sh ${weblogicScriptPath}startWebLogic.sh -Dweblogic.management.username=$weblogicUser -Dweblogic.management.password=$weblogicPassword" weblogicScriptStop=$weblogicScriptPath"stopWebLogic.sh $weblogicUser $weblogicPassword" # Managed Weblogic managedWeblogicScriptStart="nohup sh ${weblogicScriptPath}startManagedWebLogic.sh $weblogicManagedServerName $weblogicAdminURL -Dweblogic.management.username=$weblogicUser -Dweblogic.management.password=$weblogicPassword" managedWeblogicScriptStop=$weblogicScriptPath"stopManagedWebLogic.sh $weblogicManagedServerName $weblogicAdminURL $weblogicUser $weblogicPassword" #Oracle Instance OracleInstanceScript=$ORACLE_INSTANCE/bin/opmnctl OracleInstanceStatus="$OracleInstanceScript status -l" OracleInstanceScriptStart="$OracleInstanceScript startall" OracleInstanceScriptStop="$OracleInstanceScript stopall" # Node Manager NodeManagerScript=$WL_HOME/server/bin/startNodeManager.sh NodeManagerScript="nohup sh $NodeManagerScript" ############################################ # Check if servers are already running ############################################ function check_running { what=$1 ps aux | grep -ir "$what" | grep -v "grep -ir $what" > /dev/null result=$? if [ $result != 1 ] then echo "It looks like $what is still running! Operation is canceled.." exit 1 fi } ################################ # Start the services ################################ function start { serviceName="$1" serviceScript="$2" valuetogrep="$3" logfile="$4" echo "Starting $serviceName" if [ "$serviceName" != "OPMN" ] then cat /dev/null > $logfile eval $serviceScript > $logfile 2>&1 & tail $logfile | grep "$valuetogrep" status=$? elaspedTime=0 while [ $status = 1 ]; do sleep 1 tail $logfile | grep "$valuetogrep" status=$? if [ "$status" != "$valuetogrep" ] then echo -n "." ((elapsedTime += 1)) if [ "$elapsedTime" = "$weblogicTimeoutError" ] then echo "$serviceName is taking too long to start." echo " The operation is aborded. Look at $logfile to see if there is any error" exit 1 fi fi done; else eval $OracleInstanceScriptStart fi echo "$serviceName started." } ################################ # Stop the services ################################ function stop { serviceName="$1" serviceScript="$2" echo "Stopping $serviceName" eval $serviceScript } case "$1" in start) check_running "startWeblogic" check_running "weblogicmanaged" check_running "startnodemanager" check_running "opmnctl" start "Weblogic" "$weblogicScriptStart" "Server state changed to RUNNING" "/tmp/bistart.log" start "NodeManager" "$NodeManagerScript" "Secure socket listener started on port" "/tmp/bistart.log" start "Managed Weblogic" "$managedWeblogicScriptStart" "Server state changed to RUNNING" "/tmp/bistart.log" start "OPMN" "$OracleInstanceScriptStart" ;; stop) stop "OPMN" "$OracleInstanceScriptStop" stop "Managed Weblogic" "$managedWeblogicScriptStop" stop "Weblogic" "$weblogicScriptStop" pkill -TERM -f "$NodeManagerScript" pkill -TERM -f "$NodeManagerSubProcess" ;; status) eval $OracleInstanceStatus ;; *) echo "Usage: $(basename $0) start|stop|status" exit 1 esac exit 0 |