Skip to content

Instantly share code, notes, and snippets.

@codyhanson
Created September 14, 2016 15:23
Show Gist options
  • Save codyhanson/abb14b397e51f5f3b484984849840329 to your computer and use it in GitHub Desktop.
Save codyhanson/abb14b397e51f5f3b484984849840329 to your computer and use it in GitHub Desktop.
Handy script to repeatedly hit a webserver and print the response code.
#!/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