mirror of
https://github.com/mozilla/cipherscan.git
synced 2024-11-22 22:33:40 +01:00
increase paralelism of jobs
because sometimes tcping takes a long time to timeout for a lot of hosts in batch use also load average to keep the cpu busy
This commit is contained in:
parent
a213fc45d0
commit
5ef53dda9c
@ -1,13 +1,23 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
parallel=50
|
parallel=10
|
||||||
max_bg=50
|
max_bg=50
|
||||||
|
absolute_max_bg=100
|
||||||
|
max_load=50
|
||||||
|
|
||||||
|
if [ $(ulimit -u) -lt $((10*absolute_max_bg)) ]; then
|
||||||
|
echo "max user processes too low, use ulimit -u to increase"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
[ ! -e "results" ] && mkdir results
|
[ ! -e "results" ] && mkdir results
|
||||||
|
|
||||||
function wait_for_jobs() {
|
function wait_for_jobs() {
|
||||||
local no_jobs
|
local no_jobs
|
||||||
no_jobs=$(jobs | wc -l)
|
no_jobs=$(jobs | wc -l)
|
||||||
|
|
||||||
while [ $no_jobs -gt $1 ]; do
|
while [ $no_jobs -gt $1 ] || awk -v maxload=$max_load '{ if ($1 < maxload) exit 1 }' /proc/loadavg; do
|
||||||
|
if awk -v maxload=$max_load '{ if ($1 > maxload) exit 1 }' /proc/loadavg && [ $no_jobs -lt $absolute_max_bg ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
no_jobs=$(jobs | wc -l)
|
no_jobs=$(jobs | wc -l)
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user