Logging download speed and latency with Bash
Posted by Jared Thomas on 18 December 2015 02:43 PM

This is a quick and dirty script that logs the current download speed and latency to a text file. To use it, copy the script in to your home folder, adjust the log variable to suit your environment and add it to cron on some reasonable interval such as every 10 minutes. This script does not rotate the log in any way so make sure you don't leave it on indefinitely or you will end up with a massive log file.

# Variables
datetime=$(date +%c)
# Execution
echo $datetime >> $log
echo "scale=2; `curl -s -w "%{speed_download}" -o` / 131072" | bc | xargs -I {} echo {}Mb\/s >> $log
ping -c 10 >> $log
echo -en '\n' >> $log
exit 0

(0 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).