Skip to content

Instantly share code, notes, and snippets.

@chetbox
Created February 1, 2018 15:58
Show Gist options
  • Save chetbox/a958cd64aebec31c833879cbc6e1b23b to your computer and use it in GitHub Desktop.
Save chetbox/a958cd64aebec31c833879cbc6e1b23b to your computer and use it in GitHub Desktop.
Run "curl" requests in parallel in a script
PARALLEL_JOBS=4
parallel_curl() {
((i=i%$PARALLEL_JOBS)); ((i++==0)) && wait
curl "$@" &
}
parallel_curl https://url1.com
parallel_curl https://url2.com
parallel_curl https://url3.com
parallel_curl https://url4.com
parallel_curl https://url5.com
parallel_curl https://url6.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment