blob: c5e5ecb5f0ebe0e932199de20e300715cec83132 [file] [log] [blame] [raw]
#!/bin/bash
par=$1
if [[ -z "$par" ]]; then
par=5
echo "No parallel count given. Assuming $par."
fi
if ! [[ $par =~ ^[0-9]+$ ]]; then
echo "Parallel count isn't a number." > /dev/stderr
exit 1
fi
for ((i = 0; i < $par; i++)); do
./test.rb ${@:2} &
done
jobs=$(jobs -p)
#echo "jobs are $jobs"
killjobs() {
for job_pid in $jobs; do
kill $job_pid
done
}
trap killjobs SIGINT
wait $jobs