Commit 63ef1116 authored by Peter Kovary's avatar Peter Kovary
Browse files

Remove temp file when interrupted

parent cd8fb2d0
......@@ -3,9 +3,10 @@ set -e
SID=$(ps -p $$ --no-headers -o sid)
die () {
rm -f "$outputFile"
pkill -s $SID --signal SIGINT
}
trap die SIGINT
trap die EXIT
location="$(dirname "$(readlink -f "$0")")"
pushd $location > /dev/null
......@@ -118,7 +119,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