Skip to content

Instantly share code, notes, and snippets.

@ElanHasson
Forked from g105b/curlpool.sh
Created April 9, 2022 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ElanHasson/96a1b6d46e32cfdf0e05923efafb654a to your computer and use it in GitHub Desktop.
Save ElanHasson/96a1b6d46e32cfdf0e05923efafb654a to your computer and use it in GitHub Desktop.
Pool 100 parallel curl requests at a time
#!/bin/bash
target=${1:-http://example.com}
while true # loop forever, until ctrl+c pressed.
do
for i in $(seq 100) # perfrom the inner command 100 times.
do
curl $target > /dev/null & # send out a curl request, the & indicates not to wait for the response.
done
wait # after 100 requests are sent out, wait for their processes to finish before the next iteration.
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment