begin to add code to kill subprocesses on exit
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
7d8a58e6d1
commit
a16523a72f
1 changed files with 17 additions and 0 deletions
|
@ -25,6 +25,23 @@
|
|||
[ $# -ge 1 ] || __cdist_usage "[-p] <target host> [target host ]"
|
||||
set -u
|
||||
|
||||
# trap __cdist_tmp_removal EXIT
|
||||
trap killandclean EXIT
|
||||
|
||||
killandclean()
|
||||
{
|
||||
# i may have been altered outside, just use the current offset
|
||||
while [ "$i" -gt 0 ]; do
|
||||
eval pid=\$pid_$i
|
||||
kill "$pid"
|
||||
i=$((i-1))
|
||||
done
|
||||
|
||||
# Ensure tmp stuff is being removed
|
||||
__cdist_tmp_removal
|
||||
}
|
||||
|
||||
|
||||
filter()
|
||||
{
|
||||
awk -v host=$1 '{ print "[" host "] " $0 }'
|
||||
|
|
Loading…
Reference in a new issue