Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Linode speedtest
#!/bin/bash
list="
http://speedtest.newark.linode.com/100MB-newark.bin
http://speedtest.atlanta.linode.com/100MB-atlanta.bin
http://speedtest.dallas.linode.com/100MB-dallas.bin
http://speedtest.fremont.linode.com/100MB-fremont.bin
http://speedtest.frankfurt.linode.com/100MB-frankfurt.bin
http://speedtest.london.linode.com/100MB-london.bin
http://speedtest.singapore.linode.com/100MB-singapore.bin
http://speedtest.tokyo.linode.com/100MB-tokyo.bin
"
test_download_speed() {
for i in $list; do
echo $i
curl "$i" >/dev/null &
sleep 10
echo
kill $!
wait
echo
done
}
test_ping() {
for i in $list; do
host=$(echo $i | awk -F '/' '{ print $3 }')
ping -q -c 30 $host
echo
done
}
#test_download_speed
test_ping | tee log-ping.txt
awk -f ./report-ping.awk ./log-ping.txt
#!/usr/local/bin/awk -f
BEGIN {
printf "host\tloss\trtt min\tavg\tmax\tstddev\n"
}
/^---/ {
split($2, a, ".")
printf "%s\t", a[2]
}
/^[0-9]+ packets transmitted/ {
printf "%s\t", $7
}
/^round-trip/ {
split($4, a, "/")
printf "%s\t%s\t%s\t%s\n", a[1], a[2], a[3], a[4]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment