Commit c59cef67 authored by Peter Kovary's avatar Peter Kovary
Browse files

Merge branch 'dont-overkill' into 'master'

Fix an issue where processes are killed unexpectedly

Closes #18

See merge request !27
parents ed4a537e 200b3b16
#!/bin/bash
set -e
SID=$(ps -p $$ --no-headers -o sid)
children=""
die () {
pkill -s $SID --signal SIGINT
kill $children
}
trap die EXIT
......@@ -106,8 +106,11 @@ do
if ! [[ $exclusions =~ $host ]]
then
process_output "$host" "$(timeout -k 0.1 $timeout ssh $ssh_opts $host "$command_to_execute" 2>/dev/null)" &
children="$children $!"
fi
done
wait >/dev/null 2>&1
popd > /dev/null
trap - EXIT
#!/bin/bash
set -e
SID=$(ps -p $$ --no-headers -o sid)
children=""
die () {
[ "$keep" = false ] && rm -f "$outputFile"
pkill -s $SID --signal SIGINT
kill $children
}
trap die EXIT
......@@ -122,6 +122,7 @@ if [ -t 1 ]; then
while true; do
printf 'Progress: %02d%%\r' \$(x=\$(grep '' -c "$outputFile" 2>/dev/null)00; expr \$x / $HOST_COUNT)
done" &
children="$children $!"
fi
for host in ${hostlist[*]}
......@@ -129,6 +130,7 @@ do
if ! [[ $exclusions =~ $host ]]
then
echo $(timeout -k 0.1 $timeout ssh -q -o StrictHostKeyChecking=no -o ConnectTimeout=$timeout $host "finger 2>/dev/null | tr -s ' ' | grep -E '$curr' | sed -n -E 's/(.*$curr).*/\1/p' | sort | uniq" 2>/dev/null) $host >> $outputFile &
children="$children $!"
fi
done
......
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