diff --git a/scripts/init-shard.sh b/scripts/init-shard.sh index 29e503e..8467b74 100755 --- a/scripts/init-shard.sh +++ b/scripts/init-shard.sh @@ -1,14 +1,18 @@ #!/bin/bash -mongodb1=`ping -c 1 ${MONGOS} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1` +mongodb1=`getent hosts ${MONGOS} | awk '{ print $1 }'` -mongodb11=`ping -c 1 ${MONGO11} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1` -mongodb12=`ping -c 1 ${MONGO12} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1` -mongodb13=`ping -c 1 ${MONGO13} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1` +mongodb11=`getent hosts ${MONGO11} | awk '{ print $1 }'` +mongodb12=`getent hosts ${MONGO12} | awk '{ print $1 }'` +mongodb13=`getent hosts ${MONGO13} | awk '{ print $1 }'` -mongodb21=`ping -c 1 ${MONGO21} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1` -mongodb22=`ping -c 1 ${MONGO22} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1` -mongodb23=`ping -c 1 ${MONGO23} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1` +mongodb21=`getent hosts ${MONGO21} | awk '{ print $1 }'` +mongodb22=`getent hosts ${MONGO22} | awk '{ print $1 }'` +mongodb23=`getent hosts ${MONGO23} | awk '{ print $1 }'` + +mongodb31=`getent hosts ${MONGO31} | awk '{ print $1 }'` +mongodb32=`getent hosts ${MONGO32} | awk '{ print $1 }'` +mongodb33=`getent hosts ${MONGO33} | awk '{ print $1 }'` port=${PORT:-27017} diff --git a/scripts/setup-cnf.sh b/scripts/setup-cnf.sh index ba11edb..c3dcc73 100755 --- a/scripts/setup-cnf.sh +++ b/scripts/setup-cnf.sh @@ -1,8 +1,8 @@ #!/bin/bash -mongodb1=`ping -c 1 ${MONGO1} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1` -mongodb2=`ping -c 1 ${MONGO2} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1` -mongodb3=`ping -c 1 ${MONGO3} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1` +mongodb1=`getent hosts ${MONGO1} | awk '{ print $1 }'` +mongodb2=`getent hosts ${MONGO2} | awk '{ print $1 }'` +mongodb3=`getent hosts ${MONGO3} | awk '{ print $1 }'` port=${PORT:-27017} diff --git a/scripts/setup.sh b/scripts/setup.sh index 2c15cb8..f078bc5 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -1,8 +1,8 @@ #!/bin/bash -mongodb1=`ping -c 1 ${MONGO1} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1` -mongodb2=`ping -c 1 ${MONGO2} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1` -mongodb3=`ping -c 1 ${MONGO3} | head -1 | cut -d "(" -f 2 | cut -d ")" -f 1` +mongodb1=`getent hosts ${MONGO1} | awk '{ print $1 }'` +mongodb2=`getent hosts ${MONGO2} | awk '{ print $1 }'` +mongodb3=`getent hosts ${MONGO3} | awk '{ print $1 }'` port=${PORT:-27017}