728x90
반응형
#/bin/sh
dev=eth0
while ( true ) ; do
echo '<br>'
rx1=`grep $dev /proc/net/dev | awk '{print $1}' | sed 's/.*://'`
tx1=`grep $dev /proc/net/dev | awk '{print $9}'`
sleep 3
rx2=`grep $dev /proc/net/dev | awk '{print $1}' | sed 's/.*://'`
tx2=`grep $dev /proc/net/dev | awk '{print $9}'`
# 1024/8 == 128
rx3=$(((rx2-rx1)/128/3))
tx3=$(((tx2-tx1)/128/3))
echo "`date '+%k:%M:%S'` : $rx3 Kbit / $tx3 Kbit"
done
dev=eth0
while ( true ) ; do
echo '<br>'
rx1=`grep $dev /proc/net/dev | awk '{print $1}' | sed 's/.*://'`
tx1=`grep $dev /proc/net/dev | awk '{print $9}'`
sleep 3
rx2=`grep $dev /proc/net/dev | awk '{print $1}' | sed 's/.*://'`
tx2=`grep $dev /proc/net/dev | awk '{print $9}'`
# 1024/8 == 128
rx3=$(((rx2-rx1)/128/3))
tx3=$(((tx2-tx1)/128/3))
echo "`date '+%k:%M:%S'` : $rx3 Kbit / $tx3 Kbit"
done
반응형
'엔지니어 > Bash' 카테고리의 다른 글
solr 솔라 reload (0) | 2017.01.10 |
---|---|
파일유무 (0) | 2016.05.26 |
mysql backup (0) | 2016.05.26 |
geoip (0) | 2016.05.26 |
expect rsync (0) | 2016.05.26 |