Commit 89d94deb authored by Fangyi Zhou's avatar Fangyi Zhou
Browse files

Merge branch 'proper-kill' into 'master'

Add termination signal handler

See merge request !22
parents 7919c463 6b6d1fef
#!/bin/bash
set -e
SID=$(ps -p $$ --no-headers -o sid)
die () {
pkill -s $SID --signal SIGINT
}
trap die EXIT
location="$(dirname "$(readlink -f "$0")")"
pushd $location > /dev/null
......
#!/bin/bash
set -e
SID=$(ps -p $$ --no-headers -o sid)
die () {
rm -f "$outputFile"
pkill -s $SID --signal SIGINT
}
trap die EXIT
location="$(dirname "$(readlink -f "$0")")"
pushd $location > /dev/null
......@@ -113,7 +120,7 @@ HOST_COUNT=$(wc -w .hosts | cut -d ' ' -f 1)
if [ -t 1 ]; then
timeout -k 1 $timeout bash -ce "
while true; do
printf 'Progress: %02d%%\r' \$(x=\$(grep '' -c "$outputFile")00; expr \$x / $HOST_COUNT)
printf 'Progress: %02d%%\r' \$(x=\$(grep '' -c "$outputFile" 2>/dev/null)00; expr \$x / $HOST_COUNT)
done" &
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment