Omaha #3363 fixed ini lookup precedence and improved loggin in cave.sh

Change-Id: Ib710d0720a36791d00018e3a4905d27b0b435298

Former-commit-id: e89daec94625b33f20fc6a9106a63202f4bc7075
This commit is contained in:
Brian Clements 2014-07-10 16:27:29 -05:00
parent 984842331d
commit 871a8655c8
2 changed files with 43 additions and 32 deletions

View file

@ -30,6 +30,7 @@
# around this script. # around this script.
# Jan 24, 2014 #2739 bsteffen Log exit status # Jan 24, 2014 #2739 bsteffen Log exit status
# Jan 30, 2014 #2593 bclement warns based on memory usage, fixed for INI files with spaces # Jan 30, 2014 #2593 bclement warns based on memory usage, fixed for INI files with spaces
# Jul 10, 2014 #3363 bclement logs command used to launch application to console logs
# #
# #
@ -240,10 +241,13 @@ curTime=`date +%Y%m%d_%H%M%S`
nohup ${CAVE_INSTALL}/monitorThreads.sh $pid >> /dev/null 2>&1 & nohup ${CAVE_INSTALL}/monitorThreads.sh $pid >> /dev/null 2>&1 &
fi fi
echo "Launching cave application using the following command: " >> ${LOGFILE}
echo "${CAVE_INSTALL}/cave ${CAVE_INI_ARG} ${SWITCHES} ${USER_ARGS[@]}" >> ${LOGFILE}
if [[ "${redirect}" == "true" ]] ; then if [[ "${redirect}" == "true" ]] ; then
exec ${CAVE_INSTALL}/cave ${CAVE_INI_ARG} ${SWITCHES} "${USER_ARGS[@]}" > ${LOGFILE} 2>&1 exec ${CAVE_INSTALL}/cave ${CAVE_INI_ARG} ${SWITCHES} "${USER_ARGS[@]}" >> ${LOGFILE} 2>&1
else else
exec ${CAVE_INSTALL}/cave ${CAVE_INI_ARG} ${SWITCHES} "${USER_ARGS[@]}" 2>&1 | tee ${LOGFILE} exec ${CAVE_INSTALL}/cave ${CAVE_INI_ARG} ${SWITCHES} "${USER_ARGS[@]}" 2>&1 | tee -a ${LOGFILE}
fi fi
) & ) &

View file

@ -34,6 +34,7 @@
# Mar 13 2014 #15348 kjohnson added function to remove logs # Mar 13 2014 #15348 kjohnson added function to remove logs
# Jun 20, 2014 #3245 bclement forEachRunningCave now accounts for child processes # Jun 20, 2014 #3245 bclement forEachRunningCave now accounts for child processes
# Jul 02, 2014 #3245 bclement account for memory override in vm arguments # Jul 02, 2014 #3245 bclement account for memory override in vm arguments
# Jul 10, 2014 #3363 bclement fixed precedence order for ini file lookup
source /awips2/cave/iniLookup.sh source /awips2/cave/iniLookup.sh
@ -50,40 +51,46 @@ BYTES_IN_KB=1024
BYTES_IN_MB=1048576 BYTES_IN_MB=1048576
BYTES_IN_GB=1073741824 BYTES_IN_GB=1073741824
# Looks up ini file first by component/perspective
# then by SITE_TYPE before falling back to cave.ini.
# Sets ini file cave argument string in $CAVE_INI_ARG.
# Returns 0 if component/perspective found in args, else 1.
function lookupINI() function lookupINI()
{ {
# Arguments: # only check for component/perspective if arguments aren't empty
# if [[ "${1}" != "" ]]; then
if [ "${1}" == "" ]; then position=1
return 1 for arg in $@; do
if [ "${arg}" == "-component" ] ||
[ "${arg}" == "-perspective" ]; then
# Get The Next Argument.
position=$(( $position + 1 ))
nextArg=${!position}
retrieveAssociatedINI ${arg} "${nextArg}"
RC=$?
if [ ${RC} -eq 0 ]; then
export CAVE_INI_ARG="--launcher.ini /awips2/cave/${ASSOCIATED_INI}"
return 0
fi
fi
position=$(( $position + 1 ))
done
fi fi
position=1 # if ini wasn't found through component or perspective
for arg in $@; do if [[ -z $CAVE_INI_ARG ]]
if [ "${arg}" == "-component" ] || then
[ "${arg}" == "-perspective" ]; then # attempt to fall back to site type specific ini
# Get The Next Argument. siteTypeIni="/awips2/cave/${SITE_TYPE}.ini"
position=$(( $position + 1 )) if [[ -e ${siteTypeIni} ]]
nextArg=${!position} then
export CAVE_INI_ARG="--launcher.ini ${siteTypeIni}"
retrieveAssociatedINI ${arg} "${nextArg}" else
RC=$? # cave.ini if all else fails
if [ ${RC} -eq 0 ]; then export CAVE_INI_ARG="--launcher.ini /awips2/cave/cave.ini"
export CAVE_INI_ARG="--launcher.ini /awips2/cave/${ASSOCIATED_INI}" fi
else fi
siteTypeIni="/awips2/cave/${SITE_TYPE}.ini"
if [[ -e ${siteTypeIni} ]]
then
export CAVE_INI_ARG="--launcher.ini ${siteTypeIni}"
else
export CAVE_INI_ARG="--launcher.ini /awips2/cave/cave.ini"
fi
fi
return 0
fi
position=$(( $position + 1 ))
done
return 1 return 1
} }