# @(#)91 1.1 src/43haes/usr/sbin/cluster/sa/oraappsrv/sbin/IO.sh, hacmp, 61haes_r714 11/28/11 15:13:00 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/usr/sbin/cluster/sa/oraappsrv/sbin/IO.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 ## ## NAME: IO ## ## PURPOSE: ## This file includes logging related functions. Some of the fucntions makes use of an array ## called SA_Catalog defined in a file called Catalog ## #---------------------------------------------------------------------------- # Global Definitions: #---------------------------------------------------------------------------- # Read in the message catalog entries . /usr/es/sbin/cluster/sa/oracle/sbin/Catalog function user_msg { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x typeset -i s=$1 typeset -i id=$2 shift shift typeset args=$* typeset c="$s,$id" [[ -z $s || -z $id ]] && { return 1 } /usr/bin/dspmsg -s $s "${SA_Catalog[catalog]}" $id "${SA_Catalog[$c]}" $args echo # Log the information to the oraclesa.log log file typeset msg=$(LC_ALL=C /usr/bin/dspmsg -s $s "${SA_Catalog[catalog]}" $id "${SA_Catalog[$c]}" $args) log_msg $msg } function InternalErrorAbort { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x typeset date=$(date +"%m.%d.%y-%H-%M-%S") typeset logfile="/var/hacmp/log/oraclesa.fatal.$date" cp -f $ORACLESA_LOGFILE $logfile 2>/dev/null user_msg 30 100 $logfile exit 1 } function osaGetLogPath { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x typeset LOGFILE="oraappsa.log" typeset DEFAULTLOGPATH=$(odmget -q "name=oraappsa.log" HACMPlogs 2>/dev/null | grep -w value | awk -F'=' '{ print $2 }' | sed -e"s/\"//g") [[ -z $ORACLESA_LOGPATH ]] && { [[ -z $DEFAULTLOGPATH ]] && { LOGFILE="/var/hacmp/log/oraappsa.log" } || { LOGFILE="$DEFAULTLOGPATH/$LOGFILE" } } || { LOGFILE="$ORACLESA_LOGPATH/$LOGFILE" } echo $LOGFILE } function log_msg { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x DATE=$(/bin/date +"%D %T") echo $DATE INFO: $* >> $ORACLESA_LOGFILE } function warn_msg { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x DATE=$(/bin/date +"%D %T") echo $DATE WARN: $* >> $ORACLESA_LOGFILE } function osaError { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x DATE=$(/bin/date +"%D %T") echo $DATE ERROR: $1 >> $ORACLESA_LOGFILE } #---------------------------------------------------------------------------- # Main: #---------------------------------------------------------------------------- ORACLESA_LOGFILE=$(osaGetLogPath)