]>
git.rmz.io Git - dotfiles.git/blob - bin/speedtest
4 # returns ping= download= upload=
5 librespeed
-cli --server 43 --simple 2>&1 | perl
-pe 's/(\w+)(?: \w+)?:\s+([0-9]+\.[0-9]+).*/\L\1=\2/p'
9 local xx_bytes
=( $(ssh -q root@192.168.1.1 -p2222 cat /sys/class/net/$intf/statistics/{r,t}x_bytes) )
10 echo rx_bytes
=${xx_bytes[0]}
11 echo tx_bytes
=${xx_bytes[1]}
14 while [[ $# > 1 ]]; do
16 -o|--output) out
="$2"; shift 2;;
17 -s|--server) server
="$2"; shift 2;;
18 -i|--interface) intf
="$2"; shift 2;;
22 out
=${out:-speedtest.log}
25 if [[ ! -e "$out" ]]; then
26 echo "date,ping,download,upload" > "$out"
29 date=$(date --rfc-3339=seconds -u)
31 printf "%s,%.3f,%.3f,%.3f\n" "$date" "$ping" "$download" "$upload" >> "$out"