From ee159acad5aab4ca25d749dfaced45f67831cfe6 Mon Sep 17 00:00:00 2001 From: Steph Enders Date: Fri, 22 Dec 2023 14:23:50 -0500 Subject: Updated to use the speedtest-cli instead of python --- .gitignore | 2 ++ README | 2 ++ log.sh | 20 +++++++++----------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 2f10f56..b34b9f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ log.tsv .venv +speedtest.d +speedtest-cli \ No newline at end of file diff --git a/README b/README index 9e90f50..ae6b58a 100644 --- a/README +++ b/README @@ -2,6 +2,8 @@ This is basically just speedtest-cli --csv running indefinetly +Requires speedtest-cli (from ookla) to be available on the system + ## CSV layout The current CSV headers are: diff --git a/log.sh b/log.sh index 57ae19e..aa8b7bb 100755 --- a/log.sh +++ b/log.sh @@ -1,9 +1,6 @@ #!/usr/bin/env bash - +set -ex WORKING_DIR=$(dirname $0) -python3 -m venv $WORKING_DIR/.venv -source $WORKING_DIR/.venv/bin/activate -python3 -m pip install -I --disable-pip-version-check -r $WORKING_DIR/requirements.txt if [[ $# -ne 1 ]]; then OUTPUT=$WORKING_DIR/log.tsv @@ -12,12 +9,13 @@ else fi 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 + ./speedtest-cli --output-header -f tsv > $OUTPUT +else + len=$(wc -l $OUTPUT | cut -d' ' -f1) + if [[ $len -lt 1 ]]; then + ./speedtest-cli --output-header -f tsv > $OUTPUT + else + ./speedtest-cli -f tsv >> $OUTPUT + fi fi -speedtest-cli --csv-delimiter ' ' --csv >> $OUTPUT -- cgit v1.2.3-54-g00ecf