Skip to content

Instantly share code, notes, and snippets.

@sirkkalap
Last active March 11, 2016 12:59
Show Gist options
  • Select an option

  • Save sirkkalap/3b3523097a4e95c408e3 to your computer and use it in GitHub Desktop.

Select an option

Save sirkkalap/3b3523097a4e95c408e3 to your computer and use it in GitHub Desktop.
Take response times of a site at given interval
#!/bin/bash
# Adopted from https://josephscott.org/archives/2011/10/timing-details-with-curl/
#
url=${1:?usage "[nohup] curl-times.sh <url> [ <sleep=1> ]"}
sleep=${2:-1}
format=" time_namelookup: %{time_namelookup} time_connect: %{time_connect}, time_appconnect: %{time_appconnect}, time_pretransfer: %{time_pretransfer}, time_redirect: %{time_redirect}, time_starttransfer: %{time_starttransfer}, time_total: %{time_total}\n"
while true; do
echo -n $(date +%FT%T%z)
curl -w "${format}" -o /dev/null -s "$url"
sleep $sleep
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment