This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / Documentation / aoe / status.sh
1 #! /bin/sh
2 # collate and present sysfs information about AoE storage
3
4 set -e
5 format="%8s\t%8s\t%8s\n"
6 me=`basename $0`
7
8 # printf "$format" device mac netif state
9
10 test -z "`mount | grep sysfs`" && {
11         echo "$me Error: sysfs is not mounted" 1>&2
12         exit 1
13 }
14 test -z "`lsmod | grep '^aoe'`" && {
15         echo  "$me Error: aoe module is not loaded" 1>&2
16         exit 1
17 }
18
19 for d in `ls -d /sys/block/etherd* 2>/dev/null | grep -v p` end; do
20         # maybe ls comes up empty, so we use "end"
21         test $d = end && continue
22
23         dev=`echo "$d" | sed 's/.*!//'`
24         printf "$format" \
25                 "$dev" \
26                 "`cat \"$d/netif\"`" \
27                 "`cat \"$d/state\"`"
28 done | sort