# @(#)35 1.1 src/43haes/usr/sbin/cluster/sa/oraappsrv/sbin/ASControl.sh, hacmp, 61haes_r714 11/28/11 15:06:21 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/usr/sbin/cluster/sa/oraappsrv/sbin/ASControl.sh 1.1 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 2009,2010 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG #----------------------------------------------------------------------------- # Functions # osaASControl # osaASCompStart # osaASCompStop #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Function: # osaASControl # # Purpose: # Runs an OPMN start or stop command for a speficic component in a # specific instance. # # Arguments: # (1) type: Type of OPMN command (either: $OPMNCTL_START_ARG OR # $OPMNCTL_STOP_ARG) # (2) inst: Instance name. # (3) comp: Component name. # # Returns: # 0 on Success # 1 on failure # function osaASControl { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x typeset type=$1 typeset inst=$2 typeset comp=$3 # # If type is attempting to start OPMN processes, ensure # OPMN is started itself # if [[ "$type" == "startproc" ]]; then $OPMN_BINPATH/opmnctl ping 2>/dev/null >/dev/null if (( $? == 2 )); then /usr/bin/su - oracle -c "$OPMN_BINPATH/opmnctl start" fi fi /usr/bin/su - oracle -c "$OPMN_BINPATH/opmnctl $type ias-component=$comp" | while read line; do log_msg $line done # using ASMonitor osaFindAliveComponents $inst osaASShowStatus $inst $comp return $? } #----------------------------------------------------------------------------- # Function: # osaASCompStart # # Purpose: # Starts an AS component # # Arguments: # (1) inst: Instance name # (2) comp: component name # # Returns: # 0 if Successful # 1 otherwise # function osaASCompStart { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x typeset inst=$1 typeset comp=$2 typeset ret=0 if [[ $comp == "BI" ]]; then typeset cmp for cmp in ${AS_BI_COMPS[*]}; do osaASControl startproc $inst $cmp (( ret = $ret + $? )) done else osaASControl startproc $inst $comp ret=$? fi if [[ $ret -eq 0 ]]; then log_msg "Started $inst:$comp successfully." return 0 else osaError "Unable to start $inst:$comp." return 1 fi } #----------------------------------------------------------------------------- # Function: # osaASCompStop # # Purpose: # Notifies if a component is alive or not. # # Arguments: # (1) inst: Instance name # (2) comp: component name # # Returns: # 0 if Successful # 1 otherwise # function osaASCompStop { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x typeset inst=$1 typeset comp=$2 if [[ $comp == "BI" ]] then typeset cmp for cmp in ${AS_BI_COMPS[*]} do osaASControl stopproc $inst $cmp (( ret = $ret + $? )) done else osaASControl stopproc $inst $comp ret=$? # Determine if there are any alive components remaining osaFindAliveComponents $inst [[ -z "${aliveASComponents[*]}" ]] && { # if not stop the OPMN daemon since no other # processes are running /usr/bin/su - oracle -c "$OPMN_BINPATH/opmnctl shutdown" } fi if (( $ret <= 1 )) then log_msg "Stopped $inst:$comp successfully." return 0 else osaError "Unable to stop $inst:$comp." return 1 fi }