So my roommate and I were annoyed about our internet beeing slow.
I thought about speedtesting my connection every so often and save the results to send them to my ISP when the internet is slow again.
I quickly binged my way to through to some tutorials and the simplest way was to use speedtest-cli, cron,scp and a windows shortcut in the startup folder.
You could follow this tutorial for the basics: https://pythonprogramming.org/monitor-your-internet-with-python/
but I extended the idea with a cronjob an scp command under windows to backup the file to my pc.
Lets go then:
First: Install speedtest-cli on the pi with python-pip.
Second: create a cronjob with “crontab -e” and enter something along these lines:
30 00 * * * date >> /var/tmp/speedlog.txt
30 00 * * * /usr/local/bin/speedtest-cli >> /var/tmp/speedlog.txt
This saves the current date in the speedlog file and adds the speedtest output.
This is going to be a big file after some weeks, but its easier than creating different files for the next step:
Third: sync your file via scp or rsync to your desktop pc. Have ssh enabled and sync your file. I did it with another cronjob inside my WSL (Windows Subsystem for Linux) and copy the file from my pi to my HDD with:
00 22 * * * scp firstname.lastname@example.org:/var/tmp/speedlog.txt ../../mnt/d/speedlog.txt
Then it dawned on me, that the WSL has to be kept open, so i found this:
Especially this part:
Open sudo config file:
Add the following line:
|1||%sudo ALL=NOPASSWD: /etc/init.d/cron start|
Fourth: win+r, enter shell:startup , create a shortcut for wsl.exe (see below) and paste something along this in the destination field:
C:\Windows\System32\wsl.exe sudo /etc/init.d/cron start
Then a linux terminal should start on pc boot. If you picked your time for the file backup at a reasonable time thats inside the window of you using your pc, that should run one time and you should see your updated file at your chosen location.