Last active
March 11, 2024 06:17
-
-
Save g105b/34ec96a305b74087d5a64db27d1b9fec 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