Merge "Omaha #3371 all subprocesses now killed when cave.sh is killed" into omaha_14.4.1

Former-commit-id: a67b7a3005 [formerly a55162c74b] [formerly 2531649c55] [formerly a67b7a3005 [formerly a55162c74b] [formerly 2531649c55] [formerly 9f58d2e08b [formerly 2531649c55 [formerly 97a0d0d8be7dd87e472dc0422a68df94d43095e1]]]]
Former-commit-id: 9f58d2e08b
Former-commit-id: bfd642714a [formerly 289a4bf786] [formerly 1baa67bc1c72c1e0f4b5c907fef13d98c99b0a66 [formerly 363766fcca]]
Former-commit-id: 81ddf83df4487258eb799b75019f3afc294f87a8 [formerly ad23d7e95d]
Former-commit-id: fd9475853b
This commit is contained in:
Nate Jensen 2014-07-14 11:15:01 -05:00 committed by Gerrit Code Review
commit 399caf2ff6

View file

@ -35,6 +35,7 @@
# 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
# Jul 11, 2014 #3371 bclement added killSpawn()
source /awips2/cave/iniLookup.sh
@ -312,13 +313,23 @@ function deleteOldCaveDiskCaches()
cd $curDir
}
# takes in a process id
# kills spawned subprocesses of pid
# and then kills the process itself
function killSpawn()
{
pid=$1
pkill -P $pid
kill $pid
}
# log the exit status and time to a log file, requires 2 args pid and log file
function logExitStatus()
{
pid=$1
logFile=$2
trap 'kill $pid' SIGHUP SIGINT SIGQUIT SIGTERM
trap 'killSpawn $pid' SIGHUP SIGINT SIGQUIT SIGTERM
wait $pid
exitCode=$?
curTime=`date --rfc-3339=seconds`