Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- dev=$1
- while sleep 1 ; do
- read newrx </sys/class/net/$dev/statistics/rx_bytes
- read newtx </sys/class/net/$dev/statistics/tx_bytes
- read newrxp </sys/class/net/$dev/statistics/rx_packets
- read newtxp </sys/class/net/$dev/statistics/tx_packets
- [ -n "$rx" ] && printf 'rx: %.2f Mbps %.1f kpps tx: %.2f Mpps %.1f kpps\n' $(((newrx-rx) / 125000)) $(((newrxp-rxp) / 1000)) $(((newtx-tx) / 125000)) $(((newtxp-txp) / 1000))
- rx=$newrx
- tx=$newtx
- rxp=$newrxp
- txp=$newtxp
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement