fix getting ip address in complex scenarios
git-svn-id: https://hyracks.googlecode.com/svn/branches/fullstack_staging@2239 123451ca-8445-de46-9d55-352943316053
diff --git a/pregelix/pregelix-core/src/main/resources/scripts/getip.sh b/pregelix/pregelix-core/src/main/resources/scripts/getip.sh
new file mode 100755
index 0000000..d4fecf2
--- /dev/null
+++ b/pregelix/pregelix-core/src/main/resources/scripts/getip.sh
@@ -0,0 +1,8 @@
+if [ $OS_NAME = $LINUX_OS ];
+then
+ #Get IP Address
+ IPADDR=`/sbin/ifconfig eth0 | grep "inet addr" | awk '{print $2}' | cut -f 2 -d ':'`
+else
+ IPADDR=`/sbin/ifconfig en1 | grep "inet " | awk '{print $2}' | cut -f 2 -d ':'`
+fi
+echo $IPADDR
diff --git a/pregelix/pregelix-core/src/main/resources/scripts/startcc.sh b/pregelix/pregelix-core/src/main/resources/scripts/startcc.sh
index 3af0c19..6dab68d 100644
--- a/pregelix/pregelix-core/src/main/resources/scripts/startcc.sh
+++ b/pregelix/pregelix-core/src/main/resources/scripts/startcc.sh
@@ -6,7 +6,7 @@
#Get the IP address of the cc
CCHOST_NAME=`cat conf/master`
-CCHOST=`dig +short $CCHOST_NAME`
+CCHOST=`host $CCHOST_NAME|awk '{print $4}'`
#Remove the temp dir
rm -rf $CCTMP_DIR
diff --git a/pregelix/pregelix-core/src/main/resources/scripts/startnc.sh b/pregelix/pregelix-core/src/main/resources/scripts/startnc.sh
index db86d37..0f468c9 100644
--- a/pregelix/pregelix-core/src/main/resources/scripts/startnc.sh
+++ b/pregelix/pregelix-core/src/main/resources/scripts/startnc.sh
@@ -1,8 +1,10 @@
hostname
+MY_NAME=`hostname`
#Get the IP address of the cc
CCHOST_NAME=`cat conf/master`
-CCHOST=`dig +short $CCHOST_NAME`
+CURRENT_PATH=`pwd`
+CCHOST=`host $CCHOST_NAME|awk '{print $4}'`
#Import cluster properties
. conf/cluster.properties
@@ -32,13 +34,8 @@
OS_NAME=`uname -a|awk '{print $1}'`
LINUX_OS='Linux'
-if [ $OS_NAME = $LINUX_OS ];
-then
- #Get IP Address
- IPADDR=`/sbin/ifconfig eth0 | grep "inet addr" | awk '{print $2}' | cut -f 2 -d ':'`
-else
- IPADDR=`/sbin/ifconfig en1 | grep "inet " | awk '{print $2}' | cut -f 2 -d ':'`
-fi
+IPADDR=`bin/getip.sh`
+#echo $IPADDR
#Get node ID
NODEID=`hostname | cut -d '.' -f 1`