[openib-general] [PATCH] ibstatus script quickfix

Tom Duffy tduffy at sun.com
Thu Jan 6 16:22:53 PST 2005


If certain fields do not exist on the node you are running ibstatus
script on, like when Roland adds a new one and you haven't upgraded yet,
have ibstatus behave better.

Signed-off-by: Tom Duffy <tduffy at sun.com>

Index: gen2/trunk/src/userspace/management/diags/host/scripts/ibstatus
===================================================================
--- gen2/trunk/src/userspace/management/diags/host/scripts/ibstatus	(revision 1492)
+++ gen2/trunk/src/userspace/management/diags/host/scripts/ibstatus	(working copy)
@@ -25,12 +25,12 @@
 port_status() {
 	port_dir="$infiniband_base/$1/ports/$2"
 	echo "Infiniband device '$1' port $2 status:"
-	echo "	default gid:	" `cat $port_dir/gids/0`
-	echo "	base lid:	" `cat $port_dir/lid`
-	echo "	sm lid:		" `cat $port_dir/sm_lid`
-	echo "	state:		" `cat $port_dir/state`
-	echo "	phys state:	" `cat $port_dir/phys_state`
-	echo "	rate:		" `cat $port_dir/rate`
+	echo "	default gid:	" `[ -r $port_dir/gids/0 ] && cat $port_dir/gids/0 || echo unknown`
+	echo "	base lid:	" `[ -r $port_dir/lid ] && cat $port_dir/lid || echo unknown`
+	echo "	sm lid:		" `[ -r $port_dir/sm_lid ] && cat $port_dir/sm_lid || echo unknown`
+	echo "	state:		" `[ -r $port_dir/state ] && cat $port_dir/state || echo unknown`
+	echo "	phys state:	" `[ -r $port_dir/phys_state ] && cat $port_dir/phys_state || echo unknown`
+	echo "	rate:		" `[ -r $port_dir/rate ] && cat $port_dir/rate || echo unknown`
 	echo
 }
 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050106/652b1b13/attachment.sig>


More information about the general mailing list