From 56684fb6dabff51b1a70bcf2c00dc6f56880dae3 Mon Sep 17 00:00:00 2001 From: linggao Date: Tue, 26 Feb 2013 14:54:55 +0000 Subject: [PATCH] handle when conserver is management node itslef. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15262 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