Omaha #3675 cave.sh changes to ensure logfile pids match actual cave pid
Change-Id: Ibabf5e3f053c8796b70bb95de2459374891f7e59 Former-commit-id:3eada560b7
[formerly 12b8010ec08ec512a79d90b5ae3b3403acfa1c8c] Former-commit-id:b24faf99cd
This commit is contained in:
parent
404a87b2c9
commit
5ae522c32a
1 changed files with 18 additions and 11 deletions
|
@ -31,6 +31,7 @@
|
|||
# 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
|
||||
# Oct 10, 2014 #3675 njensen Logback now does console logging to ensure correct pid
|
||||
#
|
||||
#
|
||||
|
||||
|
@ -210,13 +211,14 @@ curTime=`date +%Y%m%d_%H%M%S`
|
|||
(
|
||||
export pid=`/bin/bash -c 'echo $PPID'`
|
||||
|
||||
LOGFILE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_console.log"
|
||||
export LOGFILE_CAVE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_alertviz.log"
|
||||
export LOGFILE_PERFORMANCE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_perf.log"
|
||||
LOGFILE_STARTUP_SHUTDOWN="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_startup-shutdown.log"
|
||||
export LOGFILE_CAVE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_logs.log"
|
||||
export LOGFILE_CONSOLE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_console.log"
|
||||
export LOGFILE_PERFORMANCE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_perf.log"
|
||||
|
||||
# can we write to log directory
|
||||
if [ -w ${LOGDIR} ]; then
|
||||
touch ${LOGFILE}
|
||||
touch ${LOGFILE_STARTUP_SHUTDOWN}
|
||||
fi
|
||||
|
||||
# remove "-noredirect" flag from command-line if set so it doesn't confuse any
|
||||
|
@ -241,18 +243,23 @@ 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}
|
||||
echo "Launching cave application using the following command: " >> ${LOGFILE_STARTUP_SHUTDOWN}
|
||||
echo "${CAVE_INSTALL}/cave ${CAVE_INI_ARG} ${SWITCHES} ${USER_ARGS[@]}" >> ${LOGFILE_STARTUP_SHUTDOWN}
|
||||
# TODO would be cool if we spawned another process to figure out the pid of
|
||||
# the actual cave java process and logged that to the startup file to make it
|
||||
# easier to correlate a startup log to the other cave logs
|
||||
|
||||
if [[ "${redirect}" == "true" ]] ; then
|
||||
exec ${CAVE_INSTALL}/cave ${CAVE_INI_ARG} ${SWITCHES} "${USER_ARGS[@]}" >> ${LOGFILE} 2>&1
|
||||
if [[ "${redirect}" == "true" ]] ; then
|
||||
# send output to /dev/null because the logback CaveConsoleAppender will capture that output
|
||||
exec ${CAVE_INSTALL}/cave ${CAVE_INI_ARG} ${SWITCHES} "${USER_ARGS[@]}" >> /dev/null 2>&1
|
||||
else
|
||||
exec ${CAVE_INSTALL}/cave ${CAVE_INI_ARG} ${SWITCHES} "${USER_ARGS[@]}" 2>&1 | tee -a ${LOGFILE}
|
||||
# allow output to print to the console/terminal that launched CAVE
|
||||
exec ${CAVE_INSTALL}/cave ${CAVE_INI_ARG} ${SWITCHES} "${USER_ARGS[@]}" 2>&1
|
||||
fi
|
||||
) &
|
||||
|
||||
pid=$!
|
||||
LOGFILE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_console.log"
|
||||
logExitStatus $pid $LOGFILE
|
||||
LOGFILE_STARTUP_SHUTDOWN="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_startup-shutdown.log"
|
||||
logExitStatus $pid $LOGFILE_STARTUP_SHUTDOWN
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue