Skip to content

kgorinson/SpeedTest-Average

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SpeedTest-Average

Using https://github.com/rsvp/speedtest-linux this script holds a running average of ping, download, and upload

Requires jq and curl.

Doesn't work on Mac OS X for some reason, works fine on Ubuntu though.

#clear old results
rm -rf results.txt

while true;
    do
    echo "Running speedtest now. Please wait..."
    speedtest | sed -e 's|,||g' >> results.txt
    #awk '{s+=$3}END{print "ave:",s/NR}' RS=" " results.txt
    ping=$(cat results.txt | awk '{print $3}' | jq -s 'add/length')
    download=$(cat results.txt | awk '{print $4}' | jq -s 'add/length')
    upload=$(cat results.txt | awk '{print $5}' | jq -s 'add/length')
    counter=$((counter+1))


    runnumber=$(wc -l results.txt | awk '{print $1}')
    echo "Current - " $runnumber " run number "
    currentping=$(cat results.txt | tail -1 | awk '{print $3}')
    currentdl=$(cat results.txt | tail -1 | awk '{print $4}')
    currentul=$(cat results.txt | tail -1 | awk '{print $5}')
    
    echo "Ping: " $currentping 
    echo "Download: " $currentdl 
    echo "Upload: " $currentul 

    echo "----------------------"

    echo "Average after - " $runnumber " runs"
    printf "Ping: %0.2f ms\n" $ping
    printf "Download: %0.2f\n" $download
    printf "Upload: %0.2f\n" $upload
    #echo "Download: " $download
    #echo "Upload: " $upload 
    
    echo "----------------------"

    sleep 1
    
done;

About

Using https://github.com/rsvp/speedtest-linux this script holds a running average of ping, download, and upload

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages