# IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/usr/sbin/cluster/sa/sap/sbin/IO.sh 1.2 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 2008,2009 # 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 #---------------------------------------------------------------------------- # Global Definitions: #---------------------------------------------------------------------------- # Read in the message catalog entries . /usr/es/sbin/cluster/sa/sap/cat/Catalog #---------------------------------------------------------------------------- # Functions: # getLogPath # # user_msg # log_msg # warn_msg # sapsaError # #---------------------------------------------------------------------------- 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 sapsa.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/sapsa.fatal.$date" cp -f $SAPSA_LOGFILE $logfile 2>/dev/null user_msg 30 100 $logfile exit 1 } function getLogPath { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x typeset LOGFILE="sapsa.log" typeset LOGPATH=$(/usr/bin/odmget -q "name=sapsa.log" HACMPlogs 2>/dev/null | grep -w value | awk -F'=' '{ print $2 }' | sed -e "s/\"//g") typeset DEFAULTLOGPATH=$(odmget -q "name=sapsa.log" HACMPlogs 2>/dev/null | grep -w value | awk -F'=' '{ print $2 }' | sed -e"s/\"//g") [[ -z $SAPSA_LOGPATH ]] && { [[ -z $DEFAULTLOGPATH ]] && { LOGFILE="/var/hacmp/log/sapsa.log" } || { LOGFILE="$DEFAULTLOGPATH/$LOGFILE" } } || { LOGFILE="$LOGPATH/$LOGFILE" } echo $LOGFILE } function log_msg { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x DATE=$(/bin/date +"%D %T") echo $DATE INFO: $* >> $SAPSA_LOGFILE } function warn_msg { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x DATE=$(/bin/date +"%D %T") echo $DATE WARN: $* >> $SAPSA_LOGFILE } function sapsaError { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x DATE=$(/bin/date +"%D %T") echo $DATE ERROR: $1 >> $SAPSA_LOGFILE } #---------------------------------------------------------------------------- # Main: #---------------------------------------------------------------------------- SAPSA_LOGFILE=$(getLogPath)