diff options
author | Steph Enders <steph@senders.io> | 2023-11-11 22:55:28 -0500 |
---|---|---|
committer | Steph Enders <steph@senders.io> | 2023-11-11 22:55:28 -0500 |
commit | a9ea07699e4f8c7b65d9ccb84d1ccc993f9e3cad (patch) | |
tree | e5ca8f2a2b444184bba32daf651668e64dde8049 /log.sh |
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
Diffstat (limited to 'log.sh')
-rwxr-xr-x | log.sh | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -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 |