Omaha #3675 cave.sh changes to ensure logfile pids match actual cave pid
Change-Id: Ibabf5e3f053c8796b70bb95de2459374891f7e59 Former-commit-id:5ae522c32a
[formerlyb24faf99cd
] [formerly3eada560b7
[formerly 12b8010ec08ec512a79d90b5ae3b3403acfa1c8c]] Former-commit-id:3eada560b7
Former-commit-id:26e9011f35
This commit is contained in:
parent
32099edd46
commit
06a4cab622
1 changed files with 18 additions and 11 deletions
|
@ -31,6 +31,7 @@
|
||||||
# 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
|
# 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'`
|
export pid=`/bin/bash -c 'echo $PPID'`
|
||||||
|
|
||||||
LOGFILE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_console.log"
|
LOGFILE_STARTUP_SHUTDOWN="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_startup-shutdown.log"
|
||||||
export LOGFILE_CAVE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_alertviz.log"
|
export LOGFILE_CAVE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_logs.log"
|
||||||
export LOGFILE_PERFORMANCE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_perf.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
|
# can we write to log directory
|
||||||
if [ -w ${LOGDIR} ]; then
|
if [ -w ${LOGDIR} ]; then
|
||||||
touch ${LOGFILE}
|
touch ${LOGFILE_STARTUP_SHUTDOWN}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove "-noredirect" flag from command-line if set so it doesn't confuse any
|
# 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 &
|
nohup ${CAVE_INSTALL}/monitorThreads.sh $pid >> /dev/null 2>&1 &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Launching cave application using the following command: " >> ${LOGFILE}
|
echo "Launching cave application using the following command: " >> ${LOGFILE_STARTUP_SHUTDOWN}
|
||||||
echo "${CAVE_INSTALL}/cave ${CAVE_INI_ARG} ${SWITCHES} ${USER_ARGS[@]}" >> ${LOGFILE}
|
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
|
if [[ "${redirect}" == "true" ]] ; then
|
||||||
exec ${CAVE_INSTALL}/cave ${CAVE_INI_ARG} ${SWITCHES} "${USER_ARGS[@]}" >> ${LOGFILE} 2>&1
|
# 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
|
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
|
fi
|
||||||
) &
|
) &
|
||||||
|
|
||||||
pid=$!
|
pid=$!
|
||||||
LOGFILE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_console.log"
|
LOGFILE_STARTUP_SHUTDOWN="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_startup-shutdown.log"
|
||||||
logExitStatus $pid $LOGFILE
|
logExitStatus $pid $LOGFILE_STARTUP_SHUTDOWN
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue