For some time now my internet connection have been unreliable to say the least. I'm paying for a 50/50 connection, but I'm seeing a steady 23/18 on average(mbps). As well as some pretty annoying latency issues... So! I want to monitor this over time, to build a waterproof case for myself.
I want to use speedtest-cli on my Ubuntu server, and by cron make it do a speedtest every 12 hours. After asking internet for advice I ended wanting to do this with Perl.
open speedtest,"speedtest-cli --simple |" or die "Cannot open speedtes +t"; $datestring = localtime(); while (<speedtest>) { if (/Download\:[0-9\.]*)/) { $speed=$1; print "$datestring : Download $speed +n"; } elsif (/Upload\:[0-9\.]*)/) { $speed=$1; print "$datestring : Upload $speed +n"; } }
...which works fine except for the fact that it doesn't print the results, rather just time/date and "Download"/"Upload".
Also; I want to store this in one .txt file, and I'm thinking that I'll do that in my crontab. Would it store each result in a new line in that file or overwrite it? Any ideas on how to do this?
Thank you for any and all help regarding this :-) PS: I can verify that the script starts speedtest-cli, and that it prints out time/date.In reply to Running speedtest-cli with Perl and cron by ethered
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |