Menu Close

How to schedule speedtest from linux server

After lots of years that i’m using  JDs Auto Speed Tester it arrived the moment of move speed tests on a linux server and a more stable system.

I just found that the great service can be use also from a script in linux, this is how to do it!

1. Download script from github:

wget -O speedtest-cli
chmod +x speedtest-cli

2. Move script to usr/bin:

sudo mv speedtest-cli /usr/bin/

3. Now we can begin with some interest things, like found best server near us:

speedtest-cli --list | head -n 20

and this returns a list of near servers:

root@vps:/usr/bin# speedtest-cli --list | head -n 20
Retrieving configuration...
Retrieving server list...
3284) Brennercom AG Spa (Bolzano, Italy) [40.59 km]
3594) Raiffeisen OnLine (Bolzano, Italy) [40.59 km]
5353) RUN Raising Unified Network AG (Bolzano, Italy) [40.59 km]
3103) E4A s.r.l. (Vicenza, Italy) [73.00 km]
1014) NTRnet (Vicenza, Italy) [73.00 km]
3679) Hynet s r l (Vicenza, Italy) [73.00 km]
3804) Interplanet Srl (Vicenza, Italy) [73.00 km]
2957) Wifiweb s.r.l. (Altavilla Vicentina, Italy) [73.87 km]
3998) Wolnext srl (Verona, Italy) [81.60 km]
4826) Inteplanet Srl (Verona, Italy) [81.60 km]
3177) Stadtwerke Bruneck - Azienda Pubbliservizi Brunico (Brunico, Italy) [92.06 km]
5970) Chobi - IT Services (Lonato del Garda, Italy) [93.63 km]
6187) Ascotlc SpA (San Vendemiano, Italy) [94.05 km]
6065) Net Global Srl (Padova, Italy) [97.72 km]
5914) 4ISP srl (Venice, Italy) [119.84 km]
3922) Stadtwerke Hall in Tirol GmbH (Hall in Tirol, Austria) [127.89 km]
2567) Prometeus di Daniela Agro (Cologno Monzese, Italy) [162.98 km]
5367) WiMORE S.r.l. (Reggio Emilia, Italy) [167.24 km]

4. after found best server for you, you can finally execute the speedtest:

speedtest-cli --server=3594 --simple

5. and this return result:

root@vps:/# speedtest-cli --server=3594 --simple
Ping: 142.62 ms
Download: 18.15 Mbit/s
Upload: 8.45 Mbit/s

If you want, you can also pass –share for have a link to speed test result (like page)

Ok we have speedtest-cli installed and working, now we need to put result to a csv for use with a html graph or process data as you like.

1. Download speedtest-csv script:

wget -O speedtest-csv
chmod +x speedtest-csv
mv speedtest-csv /usr/bin/

2. This script returns formatted csv data:

$ speedtest-csv
2014-09-06 10:07:51;2014-09-06 10:09:31;Comcast Cable;;AT&T (San Francisco, CA);20.22 km;24.536 ms;44.25 Mbits/s;4.93 Mbits/s;

3. Now we can create our CSV file with header:

$ speedtest-csv --header >> /home/www/speedtest.csv

4. And make a cronjob with:

$ speedtest-csv >> /home/www/speedtest.csv


You can see my results in charts HERE





For those who have failed to connect to the servers like this error:
Failed to retrieve list of servers

You can modify speedtest script with:

nano speedtest-cli

Search for:

urls = [

and replace with:

urls = [

You can also download from these two links the xml file and add a local url to this array so you don’t have problems to retrieve list of servers.

Posted in Linux, News


Leave a Reply

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