You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
603 B
Bash

#!/bin/bash
# Usage: doSpeedtest [<interface>] [<speedtest-server-id>]
function doSpeedtest {
if ! [ "${1}" = "" ]; then
INTERFACE=${1}
INTERFACE_ARG="-I ${INTERFACE}"
INTERFACE_TEXT=" from NIC '${INTERFACE}'"
fi
if ! [ "${2}" = "" ]; then
SERVER_ID=${2}
SERVER_ARG="-s ${SERVER_ID}"
SERVER_ID_TEXT=" to server ${SERVER_ID}"
fi
logScript "Doing internet speedtest${INTERFACE_TEXT}${SERVER_ID_TEXT}"
if ! OUT=$(speedtest -f json); then
logError "Speedtest failed"
logError "${OUT}"
else
echo
fi
}