간단한 네트웍 트래픽 측정 스크립트
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
#!/bin/sh # # Scripted by JoungKyun Kim # 2001.2.15 http://www.oops.org # This Script follows GPL2 License if [ "$1" != "" ]; then # ethnet device ETH="$1:" CHECK=/proc/net/dev CAT=/bin/cat GREP="/bin/grep ${ETH}" SED="sed -e s/${ETH}//" UPTIME=/usr/bin/uptime # parcket user check set `${CAT} ${CHECK} | ${GREP} | ${SED}` # Transmit packet let "in1 = $1" let "out1 = $9" echo "측정중입니다. 기다려주세요" sleep 10 set `${CAT} ${CHECK} | ${GREP} | ${SED}` let "in0 = $1" let "out0 = $9" let " in = ($in0 - $in1)/(10*1024)" let " out = ($out0 - $out1)/(10*1024)" echo "수신(in) $in kbyte/s" echo "송신(out) $out kbyte/s" else echo "USAGE: $0 [ethernet device no]" echo "ex) ./$0 eth0" fi exit 0 |