From dfd9d9a7a862a86baf433f60b25f739811bcb3ee Mon Sep 17 00:00:00 2001 From: linggao Date: Fri, 1 Mar 2013 15:29:42 +0000 Subject: [PATCH] Fixed SF bug #3159 rcons can not work when node.conserver is set to MN git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15341 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/rcons | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/xCAT-client/bin/rcons b/xCAT-client/bin/rcons index 463fab3d6..979759c49 100755 --- a/xCAT-client/bin/rcons +++ b/xCAT-client/bin/rcons @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh # Provide serial console access to nodes @@ -105,6 +105,24 @@ else echo "Error: nodehm.mgt or nodehm.cons for node $1 not setup." exit 1; fi + + #check if conserver is local host + result=`ping -c1 $CONSERVER 2>&1` + if [ $? -eq 0 ]; then + index1=`expr index "$result" "\("` + index2=`expr index "$result" "\)"` + pos=`expr $index1 + 1` + length=`expr $index2 - $index1` + length=`expr $length - 1` + cons_ip=`expr substr "$result" $pos $length` + ifconfig |grep "$cons_ip" + if [ $? -eq 0 ]; then + CONSERVER="" + fi + else + echo "Error: conserver $CONSERVER is not reachable." + exit 1; + fi #echo "CONS=$CONS CONSERVER=$CONSERVER" # check if others are using the console