Advertisement
foriamrootgmail

bandwith2

Jan 24th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #!/bin/bash
  2. BR1=`cat /sys/class/net/eth0/statistics/rx_bytes`
  3. BT1=`cat /sys/class/net/eth0/statistics/tx_bytes`
  4. sleep 30
  5. BR2=`cat /sys/class/net/eth0/statistics/rx_bytes`
  6. BT2=`cat /sys/class/net/eth0/statistics/tx_bytes`
  7. INKB=$(((($BR2-$BR1) /30) /1024))
  8. OUTKB=$(((($BT2-$BT1) /30) /1024))
  9. echo `expr $INKB / 30` "IN"
  10. echo `expr $OUTKB / 30` "OUT"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement