-
-
Save ElanHasson/96a1b6d46e32cfdf0e05923efafb654a to your computer and use it in GitHub Desktop.
Pool 100 parallel curl requests at a time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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