From d2c331b9f036951eef062dd5141c75182375ba12 Mon Sep 17 00:00:00 2001 From: Simon Parri Date: Tue, 22 Jul 2025 00:56:22 +0200 Subject: Add current configuration --- common/bin/bandwidthtest | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 common/bin/bandwidthtest (limited to 'common/bin/bandwidthtest') diff --git a/common/bin/bandwidthtest b/common/bin/bandwidthtest new file mode 100755 index 0000000..baac413 --- /dev/null +++ b/common/bin/bandwidthtest @@ -0,0 +1,20 @@ +#!/bin/sh + +start="$(($(cat /sys/class/net/$1/statistics/rx_bytes | paste -sd '+')))" +end="$(($(cat /sys/class/net/$1/statistics/rx_bytes | paste -sd '+')))" +if [ "$2" ]; then + delay="$2" +else + delay=10 +fi + +printf "Recording bandwidth.\n" + +report() { +printf '%4dB\n' $(numfmt --to=iec $(($end - $start))) +} + +trap report SIGINT +while sleep "$delay"; do + report +done -- cgit v1.2.3