Files
Misc-Scripts/run-all-speedtests.sh

35 lines
958 B
Bash
Executable File

#!/usr/bin/env bash
if [ -d /opt/idssys/defaults ]; then
source /opt/idssys/defaults/colors.inc
source /opt/idssys/defaults/default.inc
else
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
fi
echo
if [ "${1}" == "" ]; then
echo -e "${idsCL[LightGreen]}Run All Local Speedtests${idsCL[Default]}"
local_servers=$(speedtest -L)
test_servers=(${local_servers//$'\n'/ })
else
echo -e "${idsCL[LightGreen]}Run Speedtests on '${1}'${idsCL[Default]}"
IFS=,; test_servers=(${1}); unset IFS
fi
echo
echo -en "${idsCL[LightCyan]}Do you wish to continue (y/N)?${idsCL[Default]}"
read -n 1 continue
echo
echo
case $continue in
[Yy])
for serverID in ${test_servers[@]}; do
sid='^[[:digit:]]{4,6}$'
[[ ${serverID} =~ ${sid} ]] && echo -e "${idsCL[Green]}Running on '${serverID}'${idsCL[Default]}" && sleep 5s && speedtest -s ${serverID}
done
echo
;;
esac
exit 0