DEV Community

Query Filter
Query Filter

Posted on

parallel

MAXJOBS=8

while read id; do
    verify_one "$id" &   # run in background

    # throttle: if too many jobs running, wait until one finishes
    while (( $(jobs | wc -l) >= MAXJOBS )); do
        sleep 0.1
    done

done < sybase_ids.txt

wait   # wait for all background jobs to finish

Enter fullscreen mode Exit fullscreen mode

Top comments (0)