From a9ea07699e4f8c7b65d9ccb84d1ccc993f9e3cad Mon Sep 17 00:00:00 2001 From: Steph Enders Date: Sat, 11 Nov 2023 22:55:28 -0500 Subject: Initial commit of simple functional speedtest log This series of scripts simply calls speedtest-cli python module to basically log its data to a tsv file (expected log.tsv) This will basically allow then ./plot.sh to plot the file datapoints The idea is to set this up as a cron and then you can plot the data over time --- log.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 log.sh (limited to 'log.sh') diff --git a/log.sh b/log.sh new file mode 100755 index 0000000..7357c76 --- /dev/null +++ b/log.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +WORKING_DIR=$(dirname $0) +python3 -m venv $WORKING_DIR/.venv +source $WORKING_DIR/.venv/bin/activate +python3 -m pip install -r $WORKING_DIR/requirements.txt + +if [[ $# -ne 1 ]]; then + echo "You must supply a target file" + exit 1 +fi + +OUTPUT=$1 + +if [[ ! -f $OUTPUT ]]; then + speedtest-cli --csv-header | sed -E 's/,/\t/g' > $OUTPUT +fi + +len=$(wc -l $OUTPUT | cut -d' ' -f1) +if [[ $len -le 0 ]]; then + speedtest-cli --csv-header | sed -E 's/,/\t/g' > $OUTPUT +fi + +speedtest-cli --csv-delimiter ' ' --csv >> $OUTPUT -- cgit v1.2.3-54-g00ecf