From 56cf428d4c4c234196ed5a27a7a1005184b594eb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 8 Jun 2011 21:19:05 +0200 Subject: [PATCH] use kill 0 on SIGINT and SIGTERM, but not on trap EXIT Signed-off-by: Nico Schottelius --- bin/cdist-config | 10 ++++++---- bin/cdist-mass-deploy | 13 ------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/bin/cdist-config b/bin/cdist-config index 363f95fb..5bbeed6e 100644 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -355,15 +355,17 @@ __cdist_tmp_removal() rm -rf "${__cdist_tmp_dir}" } -__cdist_exit_on_kill() +__cdist_kill_on_interrupt() { - # FIXME: before 1.8.0 -> kill all children, but do not segfault - # kill 0 __cdist_tmp_removal + kill 0 } +# Remove tempfiles at normal exit trap __cdist_tmp_removal EXIT -trap __cdist_exit_on_kill INT TERM + +# Kill children on interrupt +trap __cdist_kill_on_interrupt INT TERM ################################################################################ diff --git a/bin/cdist-mass-deploy b/bin/cdist-mass-deploy index 96427f7a..b562d0f8 100755 --- a/bin/cdist-mass-deploy +++ b/bin/cdist-mass-deploy @@ -25,19 +25,6 @@ [ $# -ge 1 ] || __cdist_usage "[-p] [target host ]" set -u -# trap __cdist_tmp_removal EXIT -trap killandclean EXIT - -killandclean() -{ - __cdist_echo info "Existing and killing children..." - kill 0 - - # Ensure tmp stuff is being removed - __cdist_cleanly_exit -} - - filter() { awk -v host=$1 '{ print "[" host "] " $0 }'