Skip to content

Instantly share code, notes, and snippets.

@dannycroft
Created May 8, 2017 17:19
Show Gist options
  • Save dannycroft/d1ee14d4ca345a52a67243a97127e7ea to your computer and use it in GitHub Desktop.
Save dannycroft/d1ee14d4ca345a52a67243a97127e7ea to your computer and use it in GitHub Desktop.
#!/bin/bash
# ./ttfb https://www.google.com ~/your-log-file.txt
function ttfb() {
curl -o /dev/null \
-H 'Cache-Control: no-cache' \
-s \
-w "%{time_connect} %{time_starttransfer} %{time_total}" \
$1
}
echo $(date "+%Y-%m-%d %H:%M:%S") $1 $(ttfb $1) | tr '\n' ' ' | sed 's/$//g' >> $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment