Skip to content

Instantly share code, notes, and snippets.

@masterbpro
Created February 17, 2022 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masterbpro/0c9f88fc158043d8455f3a42f3d9cc14 to your computer and use it in GitHub Desktop.
Save masterbpro/0c9f88fc158043d8455f3a42f3d9cc14 to your computer and use it in GitHub Desktop.
#!/bin/sh
case "$1" in
100) URL="http://ftp.corbina.ru/pub/100Mb"
FILE_SIZE="10485760"
;;
10) URL="http://ftp.corbina.ru/pub/10Mb"
FILE_SIZE="10485760"
;;
*) URL="http://ftp.corbina.ru/pub/10Mb"
FILE_SIZE="10485760"
;;
esac
BEFORE_TIME=`date +%s`
wget -O /dev/null $URL
AFTER_TIME=`date +%s`
TOTAL_TIME=$(($AFTER_TIME - $BEFORE_TIME))
MB_FILE_SIZE=$((($FILE_SIZE / 1048576) / $TOTAL_TIME))
kB_FILE_SIZE=$((($FILE_SIZE / 1024) / $TOTAL_TIME))
Mb_FILE_SIZE=$(((($FILE_SIZE / 1048576) * 8) / $TOTAL_TIME))
echo "Average download Speeds:"
echo "$MB_FILE_SIZE MB/s"
echo "$kB_FILE_SIZE kB/s"
echo "$Mb_FILE_SIZE Mb/s"
@masterbpro
Copy link
Author

masterbpro commented Feb 17, 2022

wget http://ftp245070.ispsite.ru/speed_test.sh
chmod +x speed_test.sh
./speed_test.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment