-
-
Save erdoukki/cd75b8f9ac3e7bf79271f3be4965aa4e to your computer and use it in GitHub Desktop.
Realtime Bandwidth monitor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| clear | |
| declare -i rxnow txnow txlast rxlast | |
| while true | |
| do | |
| chain=`ifconfig $1|grep bytes` | |
| rxnow=`echo $chain | cut -d ":" -f2 | cut -d " " -f1` | |
| txnow=`echo $chain | cut -d ":" -f3 | cut -d " " -f1` | |
| rxdelta=$((rxnow-rxlast)) | |
| txdelta=$((txnow-txlast)) | |
| rxk=$(echo "scale=2; $rxdelta/1024"|bc) | |
| txk=$(echo "scale=2; $txdelta/1024"|bc) | |
| rxm=$(echo "scale=2; $rxk/1024"|bc) | |
| txm=$(echo "scale=2; $txk/1024"|bc) | |
| echo -e "RX=$rxdelta B/s\t$rxk KB/s\t$rxm MB/s" | |
| echo -e "TX=$txdelta B/s\t$txk KB/s\t$txm MB/s" | |
| sleep 1 | |
| txlast=$txnow | |
| rxlast=$rxnow | |
| clear | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
opkg update
opkg install bash bc
./bandwidth.sh wan