zebscripts/AFK-Daily

Add: Check for network speed

Closed this issue · 2 comments

The script handles slow networks really badly, as timings are hardcoded here and there. It would be nice to run a wget or maybe ping when running deploy.sh to check if the internet is slow. In case it is, let the user know that the script might not execute as expected.

wget is not part of Git bash... so it requires to be added later ;)

This article (in french...) explains how to check it with different tools: https://korben.info/mesurez-votre-debit-internet-en-ligne-de-commande.html
Or in English this thread: https://askubuntu.com/questions/104755/how-to-check-internet-speed-via-terminal

Column Average Dload

Command:
IPv4 uniquement :

$ curl --max-time 8 -4 -o /dev/null https://bouygues.testdebit.info/10G.iso -w "%{speed_download}\n" >> stats.log
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  1 9536M    1 96.0M    0     0  12.0M      0  0:13:14  0:00:07  0:13:07 13.5M
curl: (28) Operation timed out after 8000 milliseconds with 100745216 out of 10000000000 bytes received

$ curl -4 -o /dev/null https://bouygues.testdebit.info/1G.iso -w "%{speed_download}\n" >> stats.log
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  953M  100  953M    0     0  12.9M      0  0:01:13  0:01:13 --:--:-- 14.0M

$ curl -4 -o /dev/null https://bouygues.testdebit.info/100M.iso -w "%{speed_download}\n" >> stats.log
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 95.3M  100 95.3M    0     0  12.5M      0  0:00:07  0:00:07 --:--:-- 13.3M

Output a file with Average Dload in it: %{speed_download} the average download speed that curl measured for the complete download in bytes per second.

Last line should be last test.