Created
September 14, 2016 15:23
-
-
Save codyhanson/abb14b397e51f5f3b484984849840329 to your computer and use it in GitHub Desktop.
Handy script to repeatedly hit a webserver and print the response code.
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 | |
# Example Output and Usage | |
# clh@mint ~ $ ./curlloop.sh google.com | |
# 0: http://www.google.com/ - 200 | |
# 1: http://www.google.com/ - 200 | |
# 2: http://www.google.com/ - 200 | |
# 3: http://www.google.com/ - 200 | |
COUNT=0 | |
while true; do | |
echo "$COUNT: $(curl -L -m 1 -s -o /dev/null -w "%{url_effective} - %{http_code}\n" $1)" | |
sleep 1 | |
COUNT=$((COUNT + 1)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment