[Ocfs2-tools-commits] smushran commits r794 - trunk/extras
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Apr 11 20:08:33 CDT 2005
Author: smushran
Date: 2005-04-11 20:08:31 -0500 (Mon, 11 Apr 2005)
New Revision: 794
Modified:
trunk/extras/watch-hb.sh
Log:
watch-hb accepts -d <dev> also
Modified: trunk/extras/watch-hb.sh
===================================================================
--- trunk/extras/watch-hb.sh 2005-04-11 21:44:32 UTC (rev 793)
+++ trunk/extras/watch-hb.sh 2005-04-12 01:08:31 UTC (rev 794)
@@ -7,29 +7,34 @@
usage() {
echo "-r region the hb region to watch"
+ echo "-d device the hb device to watch"
}
-while getopts ":r:" opt; do
+while getopts ":r:d:" opt; do
case $opt in
r)
region="$OPTARG"
+ dev=$(cat $region/dev) || die "couldn't read $region/dev"
+ [ -z "$dev" ] && \
+ die "$region/dev isn't set, is the region active?"
+
+ eval "$device=/dev/$dev"
+
+ eval "slot_bytes=$(cat $region/$attr)" || die "couldn't read $region/$attr"
;;
+ d)
+ dev="$OPTARG"
+ eval "device=$dev"
+ eval "slot_bytes=512"
+ ;;
\?) usage
esac
done
-[ -z "$region" ] && \
- die "a region must be specified with -r"
+[ -z "$device" ] && \
+ die "a region must be specified with -r or a device with -d"
-dev=$(cat $region/dev) || die "couldn't read $region/dev"
-[ -z "$dev" ] && \
- die "$region/dev isn't set, is the region active?"
-
-for attr in slot_bytes; do
- eval "$attr=$(cat $region/$attr)" || die "couldn't read $region/$attr"
-done
-
watch -n 3 -d \
- "echo \"cat //heartbeat\" | debugfs.ocfs2 /dev/$dev 2>/dev/null \
+ "echo \"cat //heartbeat\" | debugfs.ocfs2 $device 2>/dev/null \
| od -A d -x | \
awk '( NF > 2 ) { \$(1) = \$1 / $slot_bytes; if (\$1 == int(\$1)) print \$0 }'"
More information about the Ocfs2-tools-commits
mailing list