Skip to content

Instantly share code, notes, and snippets.

@tochev
Created May 31, 2014 21:07
Show Gist options
  • Save tochev/f9586d4ffa82aeca9f2d to your computer and use it in GitHub Desktop.
Save tochev/f9586d4ffa82aeca9f2d to your computer and use it in GitHub Desktop.
tests bandwidth and ping to speedtest.net servers
#!/bin/bash
set -e
# tests bandwidth and ping to speedtest.net servers
# uses https://github.com/sivel/speedtest-cli/
TEST_SERVERS=(
"2320) ComNet Bulgaria (Sofia, Bulgaria)"
"1917) VIVACOM (Sofia, Bulgaria)"
"2294) ComNet Bulgaria (Burgas, Bulgaria)"
"1746) Vodafone DE (Frankfurt, Germany)"
"1756) Vodafone IE (Dublin, Ireland)"
"4358) KPN (Amsterdam, Netherlands)"
"2947) Atlantic Metro (New York City, NY, United States)"
"1355) DreamHost (Los Angeles, CA, United States)"
"2322) RuTube (Moscow, Russian Federation)"
"3633) China Telecom (Shanghai, China)"
"2173) Internode (Sydney, Australia)"
"2990) MTN SA (Johannesburg, South Africa)"
"3830) Claro (Rio de Janeiro, Brazil)"
)
SCRIPT_LOCATION=https://github.com/sivel/speedtest-cli/raw/2da8a26038078e6eaf5de9518ace2d650cdb3d3e/speedtest_cli.py
if wget "$SCRIPT_LOCATION" -O speedtest.py -q; then
sha1sum -c --quiet <<<'b5d7ed8293ac6f595dfeef7e556c39ce52eb99cb speedtest.py'
else
echo 2>&1 "Unable to download script"
exit 1
fi
## Test if servers are up
#for server in "${TEST_SERVERS[@]}"; do
#if python speedtest.py --list | grep "^$server" -q; then echo > /dev/null;
#else
#echo 2>&1 "$server" not found
#fi
#done
for server in "${TEST_SERVERS[@]}"; do
echo = Testing for "'${server#*) }'" =
if python speedtest.py --list | grep "^$server"; then
python speedtest.py --simple --server "${server%%)*}"
else
echo 2>&1 "$server" not found
exit 1
fi
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment