Speedtest from the CLI

Written by James McDonald

October 9, 2019

Awaiting a speed increase on you Internet connection but it’s not there yet?

Want to know within an hour when the speed increase happens?

Create a crontab entry

crontab -e

With this content

0 * * * * /Users/username/sites/speedtest/speedtest.sh >> /Users/username/sites/speedtest/output.log 2>&1

Install speedtest-cli

brew install speedtest-cli
# for parsing the json output
brew install jq

Create a script that calculates the Mbps value and set a LOWER value to send an email at in this case


BITS=`speedtest-cli --no-upload --json | jq '.download'`
CALC=`echo $BITS / $MBITS | bc`
# lowest Mbps value you will accept as the speed increasing

if [ "$CALC" -gt "$LOWER" ]
	echo "The internet speed has risen to $CALC Mbps" | mail -s "Internet SpeedTest" james@toggen.com.au
	echo `date` "Yas"
	echo `date` "MBITS = $CALC"



  1. lonni j friedman

    How are you controlling which speedtest server the test is run against? In my experience, results vary, often significantly, based on the server that is used for the test.

    • James McDonald

      In short i’m not. Australia doesn’t have too many options on the east coast so it will be Sydney or Melbourne. And given the choke point is my internet connection I wasn’t overly worried


Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…

Toggen builds a new website

So I have built and hosted a new website for Roger Clark Pest Management they are a family owned and operated Pest...


Just downloaded WizTree (not a sponsor) from https://wiztreefree.com/ It seems to do what it says on the tin which is...

Scam call from “Telstra”

Just had a call from a man with a sub-continental accent from caller ID 0734946596 Told me there was problem with my...