1 #! /bin/sh 1 #! /bin/sh 2 # collate and present sysfs information about 2 # collate and present sysfs information about AoE storage 3 # 3 # 4 # A more complete version of this script is ao 4 # A more complete version of this script is aoe-stat, in the 5 # aoetools. 5 # aoetools. 6 6 7 set -e 7 set -e 8 format="%8s\t%8s\t%8s\n" 8 format="%8s\t%8s\t%8s\n" 9 me=`basename $0` 9 me=`basename $0` 10 sysd=${sysfs_dir:-/sys} 10 sysd=${sysfs_dir:-/sys} 11 11 12 # printf "$format" device mac netif state 12 # printf "$format" device mac netif state 13 13 14 # Suse 9.1 Pro doesn't put /sys in /etc/mtab 14 # Suse 9.1 Pro doesn't put /sys in /etc/mtab 15 #test -z "`mount | grep sysfs`" && { 15 #test -z "`mount | grep sysfs`" && { 16 test ! -d "$sysd/block" && { 16 test ! -d "$sysd/block" && { 17 echo "$me Error: sysfs is not mounted" 17 echo "$me Error: sysfs is not mounted" 1>&2 18 exit 1 18 exit 1 19 } 19 } 20 20 21 for d in `ls -d $sysd/block/etherd* 2>/dev/nul 21 for d in `ls -d $sysd/block/etherd* 2>/dev/null | grep -v p` end; do 22 # maybe ls comes up empty, so we use " 22 # maybe ls comes up empty, so we use "end" 23 test $d = end && continue 23 test $d = end && continue 24 24 25 dev=`echo "$d" | sed 's/.*!//'` 25 dev=`echo "$d" | sed 's/.*!//'` 26 printf "$format" \ 26 printf "$format" \ 27 "$dev" \ 27 "$dev" \ 28 "`cat \"$d/netif\"`" \ 28 "`cat \"$d/netif\"`" \ 29 "`cat \"$d/state\"`" 29 "`cat \"$d/state\"`" 30 done | sort 30 done | sort
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.