aoe-stat 619 B

123456789101112131415161718192021222324252627
  1. #! /bin/sh
  2. # collate and present sysfs information about AoE storage
  3. set -e
  4. format="%8s\t%8s\t%8s\n"
  5. me=`basename $0`
  6. sysd=${sysfs_dir:-/sys}
  7. # printf "$format" device mac netif state
  8. # Suse 9.1 Pro doesn't put /sys in /etc/mtab
  9. #test -z "`mount | grep sysfs`" && {
  10. test ! -d "$sysd/block" && {
  11. echo "$me Error: sysfs is not mounted" 1>&2
  12. exit 1
  13. }
  14. for d in `ls -d $sysd/block/etherd* 2>/dev/null | grep -v p` end; do
  15. # maybe ls comes up empty, so we use "end"
  16. test $d = end && continue
  17. dev=`echo "$d" | sed 's/.*!//'`
  18. printf "$format" \
  19. "$dev" \
  20. "`cat \"$d/netif\"`" \
  21. "`cat \"$d/state\"`"
  22. done | sort