Skip to content

Instantly share code, notes, and snippets.

@dan-r95
Last active February 24, 2020 23:01
Show Gist options
  • Save dan-r95/accd65230e9bc26953bde62b6d42ccf9 to your computer and use it in GitHub Desktop.
Save dan-r95/accd65230e9bc26953bde62b6d42ccf9 to your computer and use it in GitHub Desktop.
crontab job + speedtest-cli to measure isp speed
#!/bin/bash
# schedule with crontab -e every x hours/ minutes
# install speedtest https://www.speedtest.net/apps/cli
str1="\""
str2="\","
FILE=/home/rossy/vodafone_speed.log
if [ ! -f "$FILE" ]; then # if file does not exist, create csv header
echo "creating file $FILE !"
/usr/bin/speedtest -s 2495 -f csv --output-header >> $FILE # create new file
fi
{ echo -n ${str1}; echo -n `date "+%d.%m.%Y %H:%M:%S"`; echo -n ${str2}; } >> $FILE #append date
/usr/bin/speedtest -s 2495 -f csv >> $FILE # append throughput
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment