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

Change-Id: Ib710d0720a36791d00018e3a4905d27b0b435298

Former-commit-id: 871a8655c8 [formerly e89daec94625b33f20fc6a9106a63202f4bc7075]
Former-commit-id: 0113e109d3
This commit is contained in:
Brian Clements 2014-07-10 16:27:29 -05:00
parent 9fa0118ce9
commit c32592fd1c
2 changed files with 43 additions and 32 deletions

View file

@ -30,6 +30,7 @@
# around this script.
# Jan 24, 2014 #2739 bsteffen Log exit status
# 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 &
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
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
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
) &

View file

@ -34,6 +34,7 @@
# Mar 13 2014 #15348 kjohnson added function to remove logs
# Jun 20, 2014 #3245 bclement forEachRunningCave now accounts for child processes
# 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
@ -50,14 +51,14 @@ BYTES_IN_KB=1024
BYTES_IN_MB=1048576
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()
{
# Arguments:
#
if [ "${1}" == "" ]; then
return 1
fi
# only check for component/perspective if arguments aren't empty
if [[ "${1}" != "" ]]; then
position=1
for arg in $@; do
if [ "${arg}" == "-component" ] ||
@ -70,20 +71,26 @@ function lookupINI()
RC=$?
if [ ${RC} -eq 0 ]; then
export CAVE_INI_ARG="--launcher.ini /awips2/cave/${ASSOCIATED_INI}"
else
return 0
fi
fi
position=$(( $position + 1 ))
done
fi
# if ini wasn't found through component or perspective
if [[ -z $CAVE_INI_ARG ]]
then
# attempt to fall back to site type specific ini
siteTypeIni="/awips2/cave/${SITE_TYPE}.ini"
if [[ -e ${siteTypeIni} ]]
then
export CAVE_INI_ARG="--launcher.ini ${siteTypeIni}"
else
# cave.ini if all else fails
export CAVE_INI_ARG="--launcher.ini /awips2/cave/cave.ini"
fi
fi
return 0
fi
position=$(( $position + 1 ))
done
return 1
}