Skip to content

Instantly share code, notes, and snippets.

@dciccale
Created July 27, 2016 07:22
Show Gist options
  • Save dciccale/c5b4216323e319d8845354b3b7bb419c to your computer and use it in GitHub Desktop.
Save dciccale/c5b4216323e319d8845354b3b7bb419c to your computer and use it in GitHub Desktop.
Print http status every `n` seconds
# Print http status every n seconds
# n defaults to 1s
# usage:
# http-ping google.com .5 (500 milliseconds)
# http-ping google.com 2 (2 seconds)
http-ping() {
n=1 && (($#>1)) && n=$2
while true
do
curl -o /dev/null --silent --head --write-out '%{http_code}\n' $1
sleep ${n}
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment