From d8ce5db467c6d329af0797299dde5b650e7ffef0 Mon Sep 17 00:00:00 2001 From: Brian Clements Date: Fri, 11 Jul 2014 08:54:08 -0500 Subject: [PATCH] Omaha #3371 all subprocesses now killed when cave.sh is killed Change-Id: Ibceb3f8c8902b9df94b16fac83db69b0c4dcccc2 Former-commit-id: 0973e5ac416472bb933628145c37032972503c6f [formerly 7e70fbda27d3e26389f78833808bcdeaffdd7738] [formerly 0973e5ac416472bb933628145c37032972503c6f [formerly 7e70fbda27d3e26389f78833808bcdeaffdd7738] [formerly ae5fa893a9210f1f32f123c39d0ba76ca965d5b7 [formerly e4becce5325aad266fd93548d27e5e122b145011]]] Former-commit-id: ae5fa893a9210f1f32f123c39d0ba76ca965d5b7 Former-commit-id: a1bce34fda8f1fbce46ed6419de3de7af0d10d7f [formerly e72c34d3610fb62de8bbd28dd9c91f7ba68fad3b] Former-commit-id: 272c0a2e2dc514f70680e7a023642d5281452efe --- cave/build/static/linux/cave/caveUtil.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cave/build/static/linux/cave/caveUtil.sh b/cave/build/static/linux/cave/caveUtil.sh index ae29e90153..0a3e7ea12a 100644 --- a/cave/build/static/linux/cave/caveUtil.sh +++ b/cave/build/static/linux/cave/caveUtil.sh @@ -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`