diff --git a/package/lean/autocore/Makefile b/package/lean/autocore/Makefile index 99a8b230df2f25..6e64ca30246bee 100644 --- a/package/lean/autocore/Makefile +++ b/package/lean/autocore/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=autocore PKG_VERSION:=1 -PKG_RELEASE:=23 +PKG_RELEASE:=25 include $(INCLUDE_DIR)/package.mk diff --git a/package/lean/autocore/files/sbin/ethinfo b/package/lean/autocore/files/sbin/ethinfo index 004430b1ba1981..63a0409c396646 100755 --- a/package/lean/autocore/files/sbin/ethinfo +++ b/package/lean/autocore/files/sbin/ethinfo @@ -1,226 +1,39 @@ #!/bin/sh -info() -{ #获取网络接口数量 - a=$(ifconfig -a | grep '^eth' | sort -u | wc -l) +a=$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -v "@" | grep -v "\.") +b=$(echo "$a" | wc -l) +rm -f /tmp/state/ethinfo - #获取网络接口状态 - b=$(ethtool eth$1 | grep 'detected' | cut -f2 -d: | uniq) - if [ $b = yes ]; then - c=1 - else - c=0 - fi - - #获取网络接口速率 - d=$(ethtool eth$1 | grep 'Speed' | cut -f2 -d: | uniq) - - #获取网络双工状态 - e=$(ethtool eth$1 | grep 'Duplex' | cut -f2 -d: | cut -f1 -d! | uniq) - if [ $e = Full ]; then - f=1 - else - f=0 - fi -} - -outa() #eth0 -{ - info 0 - if [ $a = 1 ]; then - echo "[{\"name\": \"eth0\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outb 0 $c $d $f 1 - fi -} - -outb() #eth1 -{ - info 1 - if [ $a = 2 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outc 0 $2 $3 $4 1 $c $d $f 2 - fi -} - -outc() #eth2 -{ - info 2 - if [ $a = 3 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outd 0 $2 $3 $4 1 $6 $7 $8 2 $c $d $f 3 - fi -} - -outd() #eth3 -{ - info 3 - if [ $a = 4 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - oute 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 - fi -} - -oute() #eth4 -{ - info 4 - if [ $a = 5 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outf 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 - fi -} - -outf() #eth5 -{ - info 5 - if [ $a = 6 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outg 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 $22 $23 $24 6 - fi -} - -outg() #eth6 -{ - info 6 - if [ $a = 7 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $22, \"speed\": \"$23\", \"duplex\": $24},{\"name\": \"eth$25\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outh 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 $22 $23 $24 6 $26 $27 $28 7 - fi -} - -outh() #eth7 -{ - info 7 - if [ $a = 8 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $22, \"speed\": \"$23\", \"duplex\": $24},{\"name\": \"eth$25\", \"status\": $26, \"speed\": \"$27\", \"duplex\": $28},{\"name\": \"eth$29\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outi 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 $22 $23 $24 6 $26 $27 $28 7 $30 $31 $32 8 - fi -} - -outi() #eth8 -{ - info 8 - if [ $a = 9 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $22, \"speed\": \"$23\", \"duplex\": $24},{\"name\": \"eth$25\", \"status\": $26, \"speed\": \"$27\", \"duplex\": $28},{\"name\": \"eth$29\", \"status\": $30, \"speed\": \"$31\", \"duplex\": $32},{\"name\": \"eth$33\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outj 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 $22 $23 $24 6 $26 $27 $28 7 $30 $31 $32 8 $34 $35 $36 9 - fi -} - -outj() #eth9 -{ - info 9 - if [ $a = 10 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $22, \"speed\": \"$23\", \"duplex\": $24},{\"name\": \"eth$25\", \"status\": $26, \"speed\": \"$27\", \"duplex\": $28},{\"name\": \"eth$29\", \"status\": $30, \"speed\": \"$31\", \"duplex\": $32},{\"name\": \"eth$33\", \"status\": $34, \"speed\": \"$35\", \"duplex\": $36},{\"name\": \"eth$37\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outk 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 $22 $23 $24 6 $26 $27 $28 7 $30 $31 $32 8 $34 $35 $36 9 $38 $39 $40 10 - fi -} +echo -n "[" > /tmp/state/ethinfo -outk() #eth10 -{ - info 10 - if [ $a = 11 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $22, \"speed\": \"$23\", \"duplex\": $24},{\"name\": \"eth$25\", \"status\": $26, \"speed\": \"$27\", \"duplex\": $28},{\"name\": \"eth$29\", \"status\": $30, \"speed\": \"$31\", \"duplex\": $32},{\"name\": \"eth$33\", \"status\": $34, \"speed\": \"$35\", \"duplex\": $36},{\"name\": \"eth$37\", \"status\": $38, \"speed\": \"$39\", \"duplex\": $40},{\"name\": \"eth$41\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outl 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 $22 $23 $24 6 $26 $27 $28 7 $30 $31 $32 8 $34 $35 $36 9 $38 $39 $40 10 $42 $43 $44 11 +for i in $(seq 1 $b) +do + h=$(echo '{"name":' ) + c=$(echo "$a" | sed -n ${i}p) + d=$(ethtool $c) + + e=$(echo "$d" | grep "Link detected" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g') + if [ $e = yes ]; then + l=1 + else + l=0 fi -} -outl() #eth11 -{ - info 11 - if [ $a = 12 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $22, \"speed\": \"$23\", \"duplex\": $24},{\"name\": \"eth$25\", \"status\": $26, \"speed\": \"$27\", \"duplex\": $28},{\"name\": \"eth$29\", \"status\": $30, \"speed\": \"$31\", \"duplex\": $32},{\"name\": \"eth$33\", \"status\": $34, \"speed\": \"$35\", \"duplex\": $36},{\"name\": \"eth$37\", \"status\": $38, \"speed\": \"$39\", \"duplex\": $40},{\"name\": \"eth$41\", \"status\": $42, \"speed\": \"$43\", \"duplex\": $44},{\"name\": \"eth$45\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outm 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 $22 $23 $24 6 $26 $27 $28 7 $30 $31 $32 8 $34 $35 $36 9 $38 $39 $40 10 $42 $43 $44 11 $46 $47 $48 12 + f=$(echo "$d" | grep "Speed" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g' | tr -d "Unknown!") + [ -z "$f" ] && f=" - " + + g=$(echo "$d" | grep "Duplex" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g') + if [ "$g" == "Full" ]; then + x=1 + else + x=0 fi -} -outm() #eth12 -{ - info 12 - if [ $a = 13 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $22, \"speed\": \"$23\", \"duplex\": $24},{\"name\": \"eth$25\", \"status\": $26, \"speed\": \"$27\", \"duplex\": $28},{\"name\": \"eth$29\", \"status\": $30, \"speed\": \"$31\", \"duplex\": $32},{\"name\": \"eth$33\", \"status\": $34, \"speed\": \"$35\", \"duplex\": $36},{\"name\": \"eth$37\", \"status\": $38, \"speed\": \"$39\", \"duplex\": $40},{\"name\": \"eth$41\", \"status\": $42, \"speed\": \"$43\", \"duplex\": $44},{\"name\": \"eth$45\", \"status\": $46, \"speed\": \"$47\", \"duplex\": $48},{\"name\": \"eth$49\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outn 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 $22 $23 $24 6 $26 $27 $28 7 $30 $31 $32 8 $34 $35 $36 9 $38 $39 $40 10 $42 $43 $44 11 $46 $47 $48 12 $50 $51 $52 13 - fi -} - -outn() #eth13 -{ - info 13 - if [ $a = 14 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $22, \"speed\": \"$23\", \"duplex\": $24},{\"name\": \"eth$25\", \"status\": $26, \"speed\": \"$27\", \"duplex\": $28},{\"name\": \"eth$29\", \"status\": $30, \"speed\": \"$31\", \"duplex\": $32},{\"name\": \"eth$33\", \"status\": $34, \"speed\": \"$35\", \"duplex\": $36},{\"name\": \"eth$37\", \"status\": $38, \"speed\": \"$39\", \"duplex\": $40},{\"name\": \"eth$41\", \"status\": $42, \"speed\": \"$43\", \"duplex\": $44},{\"name\": \"eth$45\", \"status\": $46, \"speed\": \"$47\", \"duplex\": $48},{\"name\": \"eth$49\", \"status\": $50, \"speed\": \"$51\", \"duplex\": $52},{\"name\": \"eth$53\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outo 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 $22 $23 $24 6 $26 $27 $28 7 $30 $31 $32 8 $34 $35 $36 9 $38 $39 $40 10 $42 $43 $44 11 $46 $47 $48 12 $50 $51 $52 13 $54 $55 $56 14 - fi -} - -outo() #eth14 -{ - info 14 - if [ $a = 15 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $22, \"speed\": \"$23\", \"duplex\": $24},{\"name\": \"eth$25\", \"status\": $26, \"speed\": \"$27\", \"duplex\": $28},{\"name\": \"eth$29\", \"status\": $30, \"speed\": \"$31\", \"duplex\": $32},{\"name\": \"eth$33\", \"status\": $34, \"speed\": \"$35\", \"duplex\": $36},{\"name\": \"eth$37\", \"status\": $38, \"speed\": \"$39\", \"duplex\": $40},{\"name\": \"eth$41\", \"status\": $42, \"speed\": \"$43\", \"duplex\": $44},{\"name\": \"eth$45\", \"status\": $46, \"speed\": \"$47\", \"duplex\": $48},{\"name\": \"eth$49\", \"status\": $50, \"speed\": \"$51\", \"duplex\": $52},{\"name\": \"eth$53\", \"status\": $54, \"speed\": \"$55\", \"duplex\": $56},{\"name\": \"eth$57\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outp 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 $22 $23 $24 6 $26 $27 $28 7 $30 $31 $32 8 $34 $35 $36 9 $38 $39 $40 10 $42 $43 $44 11 $46 $47 $48 12 $50 $51 $52 13 $54 $55 $56 14 $58 $59 $60 15 - fi -} + echo -n "$h \"$c\", \"status\": $l, \"speed\": \"$f\", \"duplex\": $x}," >> /tmp/state/ethinfo +done -outp() #eth15 -{ - info 15 - if [ $a = 16 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $22, \"speed\": \"$23\", \"duplex\": $24},{\"name\": \"eth$25\", \"status\": $26, \"speed\": \"$27\", \"duplex\": $28},{\"name\": \"eth$29\", \"status\": $30, \"speed\": \"$31\", \"duplex\": $32},{\"name\": \"eth$33\", \"status\": $34, \"speed\": \"$35\", \"duplex\": $36},{\"name\": \"eth$37\", \"status\": $38, \"speed\": \"$39\", \"duplex\": $40},{\"name\": \"eth$41\", \"status\": $42, \"speed\": \"$43\", \"duplex\": $44},{\"name\": \"eth$45\", \"status\": $46, \"speed\": \"$47\", \"duplex\": $48},{\"name\": \"eth$49\", \"status\": $50, \"speed\": \"$51\", \"duplex\": $52},{\"name\": \"eth$53\", \"status\": $54, \"speed\": \"$55\", \"duplex\": $56},{\"name\": \"eth$57\", \"status\": $58, \"speed\": \"$559\", \"duplex\": $60},{\"name\": \"eth$61\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outq 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 $22 $23 $24 6 $26 $27 $28 7 $30 $31 $32 8 $34 $35 $36 9 $38 $39 $40 10 $42 $43 $44 11 $46 $47 $48 12 $50 $51 $52 13 $54 $55 $56 14 $58 $59 $60 15 $62 $63 $64 16 - fi -} - -outq() #eth16 -{ - info 16 - if [ $a = 17 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $22, \"speed\": \"$23\", \"duplex\": $24},{\"name\": \"eth$25\", \"status\": $26, \"speed\": \"$27\", \"duplex\": $28},{\"name\": \"eth$29\", \"status\": $30, \"speed\": \"$31\", \"duplex\": $32},{\"name\": \"eth$33\", \"status\": $34, \"speed\": \"$35\", \"duplex\": $36},{\"name\": \"eth$37\", \"status\": $38, \"speed\": \"$39\", \"duplex\": $40},{\"name\": \"eth$41\", \"status\": $42, \"speed\": \"$43\", \"duplex\": $44},{\"name\": \"eth$45\", \"status\": $46, \"speed\": \"$47\", \"duplex\": $48},{\"name\": \"eth$49\", \"status\": $50, \"speed\": \"$51\", \"duplex\": $52},{\"name\": \"eth$53\", \"status\": $54, \"speed\": \"$55\", \"duplex\": $56},{\"name\": \"eth$57\", \"status\": $58, \"speed\": \"$559\", \"duplex\": $60},{\"name\": \"eth$61\", \"status\": $62, \"speed\": \"$63\", \"duplex\": $64},{\"name\": \"eth$65\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outr 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 $22 $23 $24 6 $26 $27 $28 7 $30 $31 $32 8 $34 $35 $36 9 $38 $39 $40 10 $42 $43 $44 11 $46 $47 $48 12 $50 $51 $52 13 $54 $55 $56 14 $58 $59 $60 15 $62 $63 $64 16 $66 $67 $68 17 - fi -} - -outr() #eth17 -{ - info 17 - if [ $a = 18 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $22, \"speed\": \"$23\", \"duplex\": $24},{\"name\": \"eth$25\", \"status\": $26, \"speed\": \"$27\", \"duplex\": $28},{\"name\": \"eth$29\", \"status\": $30, \"speed\": \"$31\", \"duplex\": $32},{\"name\": \"eth$33\", \"status\": $34, \"speed\": \"$35\", \"duplex\": $36},{\"name\": \"eth$37\", \"status\": $38, \"speed\": \"$39\", \"duplex\": $40},{\"name\": \"eth$41\", \"status\": $42, \"speed\": \"$43\", \"duplex\": $44},{\"name\": \"eth$45\", \"status\": $46, \"speed\": \"$47\", \"duplex\": $48},{\"name\": \"eth$49\", \"status\": $50, \"speed\": \"$51\", \"duplex\": $52},{\"name\": \"eth$53\", \"status\": $54, \"speed\": \"$55\", \"duplex\": $56},{\"name\": \"eth$57\", \"status\": $58, \"speed\": \"$559\", \"duplex\": $60},{\"name\": \"eth$61\", \"status\": $62, \"speed\": \"$63\", \"duplex\": $64},{\"name\": \"eth$65\", \"status\": $66, \"speed\": \"$67\", \"duplex\": $68},{\"name\": \"eth$69\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outs 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 $22 $23 $24 6 $26 $27 $28 7 $30 $31 $32 8 $34 $35 $36 9 $38 $39 $40 10 $42 $43 $44 11 $46 $47 $48 12 $50 $51 $52 13 $54 $55 $56 14 $58 $59 $60 15 $62 $63 $64 16 $66 $67 $68 17 $70 $71 $72 18 - fi -} - -outs() #eth18 -{ - info 18 - if [ $a = 19 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $22, \"speed\": \"$23\", \"duplex\": $24},{\"name\": \"eth$25\", \"status\": $26, \"speed\": \"$27\", \"duplex\": $28},{\"name\": \"eth$29\", \"status\": $30, \"speed\": \"$31\", \"duplex\": $32},{\"name\": \"eth$33\", \"status\": $34, \"speed\": \"$35\", \"duplex\": $36},{\"name\": \"eth$37\", \"status\": $38, \"speed\": \"$39\", \"duplex\": $40},{\"name\": \"eth$41\", \"status\": $42, \"speed\": \"$43\", \"duplex\": $44},{\"name\": \"eth$45\", \"status\": $46, \"speed\": \"$47\", \"duplex\": $48},{\"name\": \"eth$49\", \"status\": $50, \"speed\": \"$51\", \"duplex\": $52},{\"name\": \"eth$53\", \"status\": $54, \"speed\": \"$55\", \"duplex\": $56},{\"name\": \"eth$57\", \"status\": $58, \"speed\": \"$559\", \"duplex\": $60},{\"name\": \"eth$61\", \"status\": $62, \"speed\": \"$63\", \"duplex\": $64},{\"name\": \"eth$65\", \"status\": $66, \"speed\": \"$67\", \"duplex\": $68},{\"name\": \"eth$69\", \"status\": $70, \"speed\": \"$71\", \"duplex\": $72},{\"name\": \"eth$73\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - else - outt 0 $2 $3 $4 1 $6 $7 $8 2 $10 $11 $12 3 $14 $15 $16 4 $18 $19 $20 5 $22 $23 $24 6 $26 $27 $28 7 $30 $31 $32 8 $34 $35 $36 9 $38 $39 $40 10 $42 $43 $44 11 $46 $47 $48 12 $50 $51 $52 13 $54 $55 $56 14 $58 $59 $60 15 $62 $63 $64 16 $66 $67 $68 17 $70 $71 $72 18 $74 $75 $76 19 - fi -} - -outt() #eth19 -{ - info 19 - if [ $a = 20 ]; then - echo "[{\"name\": \"eth$1\", \"status\": $2, \"speed\": \"$3\", \"duplex\": $4},{\"name\": \"eth$5\", \"status\": $6, \"speed\": \"$7\", \"duplex\": $8},{\"name\": \"eth$9\", \"status\": $10, \"speed\": \"$11\", \"duplex\": $12},{\"name\": \"eth$13\", \"status\": $14, \"speed\": \"$15\", \"duplex\": $16},{\"name\": \"eth$17\", \"status\": $18, \"speed\": \"$19\", \"duplex\": $20},{\"name\": \"eth$21\", \"status\": $22, \"speed\": \"$23\", \"duplex\": $24},{\"name\": \"eth$25\", \"status\": $26, \"speed\": \"$27\", \"duplex\": $28},{\"name\": \"eth$29\", \"status\": $30, \"speed\": \"$31\", \"duplex\": $32},{\"name\": \"eth$33\", \"status\": $34, \"speed\": \"$35\", \"duplex\": $36},{\"name\": \"eth$37\", \"status\": $38, \"speed\": \"$39\", \"duplex\": $40},{\"name\": \"eth$41\", \"status\": $42, \"speed\": \"$43\", \"duplex\": $44},{\"name\": \"eth$45\", \"status\": $46, \"speed\": \"$47\", \"duplex\": $48},{\"name\": \"eth$49\", \"status\": $50, \"speed\": \"$51\", \"duplex\": $52},{\"name\": \"eth$53\", \"status\": $54, \"speed\": \"$55\", \"duplex\": $56},{\"name\": \"eth$57\", \"status\": $58, \"speed\": \"$559\", \"duplex\": $60},{\"name\": \"eth$61\", \"status\": $62, \"speed\": \"$63\", \"duplex\": $64},{\"name\": \"eth$65\", \"status\": $66, \"speed\": \"$67\", \"duplex\": $68},{\"name\": \"eth$69\", \"status\": $70, \"speed\": \"$71\", \"duplex\": $72},{\"name\": \"eth$73\", \"status\": $74, \"speed\": \"$75\", \"duplex\": $76},{\"name\": \"eth$77\", \"status\": $c, \"speed\": \"$d\", \"duplex\": $f}]" - fi -} +sed -i 's/.$//' /tmp/state/ethinfo -outa +echo -n "]" >> /tmp/state/ethinfo +cat /tmp/state/ethinfo