Created
June 25, 2014 22:02
-
-
Save ehoanshelt/916231a405d4753f8363 to your computer and use it in GitHub Desktop.
Run a ttfb command with the option of how many time you want the command to run.
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
function ttfb { | |
if [[ -z ${maxcount} ]]; | |
then | |
maxcount=10 | |
fi | |
if [[ -n ${domain} ]]; | |
then | |
echo -e "\n\nTTFB measured "${maxcount}" times with 1s intervals:" | |
br="++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" | |
echo -e ${br}"\n Testing: ${domain}\n" | |
for ((c=1; c<=${maxcount}; c++)); | |
do | |
echo ${c} - $(curl -o /dev/null -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" --silent --output /dev/null ${domain}); | |
sleep 1 | |
done | |
echo ${br}; | |
else | |
echo -e "\nUsage: ttfb <domain_name>.\n\n" | |
return 0 | |
fi | |
} | |
domain=${1} | |
maxcount=${2} | |
ttfb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment