Search

I’m trialing a 4G home broadband router at the minute to see if it can give me decent upload as apposed to the 1mbps I currently get so I thought I’d look into automatically running speedtests.  Here’s how and it turned out to be quite simple.  Caveat, this runs on Linux.

There is a really handy command line util for running Speedtest.net which is a Python script.  To install it run: “sudo pip install speedtest-cli”

If you don’t have pip or python installed run this: “sudo apt install python-pip”

This will install pip and the prerequisites, one of which is Python itself.  Next up, in your home directory, run “speedtest-cli –csv-header >> speedtest.csv”.  This will create an empty CSV with only the headers in it.

Next up, and finally, run “crontab -e” and enter “*/10 * * * * /usr/local/bin/speedtest-cli –csv >> ~/speedtest.csv”.  Thanks to this thread for giving me the answer as to why it wasn’t working to start with.

That’s it!  Every 10 minutes a speedtest will be run and the results appended to the csv file.  Load it up in a spreadsheet program and job done.

It isn’t a long term solution as that csv will get unweildy after a while but this is a two week trial so not an issue.  I’ve an aging Raspberry Pi B hooked up to the router and will check the results in a day or so to see what the connection is like without anything else on it.