mirror of
https://github.com/prurigro/darkcloud-tmuxconfig.git
synced 2024-11-23 07:34:10 -05:00
5b77a6002e
of the tmux config.
27 lines
530 B
Bash
Executable file
27 lines
530 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
TIMESPAN=1
|
|
|
|
if [ -z $1 ]; then
|
|
echo "Error: no device specified"
|
|
exit 1
|
|
fi
|
|
if [ ! -d /sys/class/net/$1 ]; then
|
|
echo "No such device: $1"
|
|
exit 1
|
|
fi
|
|
|
|
BR1=`cat /sys/class/net/$1/statistics/rx_bytes`
|
|
BT1=`cat /sys/class/net/$1/statistics/tx_bytes`
|
|
|
|
sleep $TIMESPAN
|
|
|
|
BR2=`cat /sys/class/net/$1/statistics/rx_bytes`
|
|
BT2=`cat /sys/class/net/$1/statistics/tx_bytes`
|
|
|
|
DOWNKB=$(((($BR2-$BR1) / $TIMESPAN) /1024))
|
|
UPKB=$(((($BT2-$BT1) / $TIMESPAN) /1024))
|
|
|
|
echo "D ${DOWNKB}KB/s | U ${UPKB}KB/s"
|
|
|
|
exit 0
|