seasonzone

#!/bin/bash
#eval `date "+day=%d; month=%m; year=%Y; hour=%H; minute=%M second=%S"`
#INSTFIL="$year-$month-$day $hour:$minute:$second"
#INSTFIL1="$year-$month-$day" #INSTFIL2="$hour:$minute"
#INSTFIL3="$month-$day"
#INSTFIL4="$hour:$minute:$second"
R2=`cat /sys/class/net/$1/statistics/rx_bytes`
T2=`cat /sys/class/net/$1/statistics/tx_bytes`
NUM=100000
if [ -z "$1" ]; then
echo
echo usage: $0 network-interface
echo
echo e.g. $0 eth0
echo
exit
fi
IF=$1
while true
do
R1=`cat /sys/class/net/$1/statistics/rx_bytes`
T1=`cat /sys/class/net/$1/statistics/tx_bytes`
TBPS=`expr $T1 - $T2`
RBPS=`expr $R1 - $R2`
TKBPS=`expr $TBPS / 100`
RKBPS=`expr $RBPS / 100`
RKBPS1=`echo "scale=3; $RBPS/$NUM"|bc`
eval `date "+day=%d; month=%m; year=%Y; hour=%H; minute=%M second=%S"`
INSTFIL4="$hour:$minute:$second"
echo "$INSTFIL4 tx $1: $TKBPS KB/ rx $RKBPS kb/s 0$RKBPS1 bits/s"
R2=`cat /sys/class/net/$1/statistics/rx_bytes`
T2=`cat /sys/class/net/$1/statistics/tx_bytes`
sleep 1
done

分类:

技术点:

相关文章:

  • 2021-06-30
  • 2021-06-12
  • 2021-08-25
  • 2022-12-23
  • 2021-11-10
  • 2021-09-16
  • 2021-05-24
  • 2021-09-08
猜你喜欢
  • 2022-12-23
  • 2021-11-15
  • 2021-06-03
  • 2021-09-16
  • 2021-10-31
  • 2022-12-23
  • 2021-03-30
相关资源
相似解决方案