I asked for some help with speedtest-cli
a few days ago and now I need help with the following:
I made this crontab:
0 * * * * (date +"%A, %d.%m.%Y %X Uhr" >> /home/pi/speedtest/speed.txt; /usr/bin/speedtest-cli --server 3645 --simple >> /home/pi/speedtest/speed.txt; echo "\n" >> /home/pi/speedtest/speed.txt)
10 * * * * (speedtest-cli --server 3645 --share; grep -Po 'Share results: \K.*' >> /home/pi/speedtest/latest.txt)
(look here to see it better formatted: https://hastebin.com/holugehuvo.js)
I'll explain, what I want to do with it: So the first command should print the current date and time in my region format into a text file. The output of speedtest-cli --server 3645 --simple
should be appended to the same file and after that should be a new line so that I can see the next output (output one hour later) correctly formatted.
An output of the command speedtest-cli --server 3645 --simple
would be something like that:
Ping: xx.xx ms
Download: 53.09 Mbit/s
Upload: 7.92 Mbit/s
This should be repeated every hour.
And the second cron should grep the http://
address returned by the command and print that into a file called latest.txt.
An example output for speedtest-cli --server 3645 --share
would be sth like that:
Retrieving speedtest.net configuration...
Testing from Provider (xx.xxx.xxx.xxx)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Citycom Telekommunikation GmbH (Graz) [xx.xx km]: xx.xxx ms
Testing download speed................................................................................
Download: 52.88 Mbit/s
Testing upload speed....................................................................................................
Upload: 7.62 Mbit/s
Share results: http://www.speedtest.net/result/7799311524.png
I just need that http://
address because I want to read that in PHP and display this png on my local web page so that I know what was my last speed test.
Both commands should run once per hour, I used a little offset so that the speed is not influenced by the other speedtest made in the first command.
I need both outputs because I want to monitor my last speeds AND have that image accessible with PHP.
I know that this was/is a long question, but I want to give you many details so that it's easier to understand what I wanted to do.
Thank you for your help.