Browse Source

Change check, remove curl check and add check via ip a

Admin User 6 years ago
parent
commit
2c315118f2
2 changed files with 2 additions and 16 deletions
  1. 2 15
      check_ip.sh
  2. 0 1
      docker-entrypoint.sh

+ 2 - 15
check_ip.sh

@@ -1,14 +1,6 @@
 #!/bin/sh
-#service=iru-swarm.infoclinica.ru
-#floating_ip=swarm.sdsys.ru
-
-check_service() {
-  curl -f ${service}
-  if [ $? == 0 ]; then echo "${service} is up and running!!!"; return 0; else echo "${service} is down!!!"; return 1; fi
-}
-
 check_ip() {
-  curl -f ${vip}
+  ip a | grep ${vip}/${vin}
   if [ $? == 0 ]; then echo "${vip} is exist!!!"; return 0; else echo "The ${vip} doesn't exist!"; return 1; fi
 }
 
@@ -16,12 +8,7 @@ check=0
 
 while [ ${check} -eq 0 ]
 do 
-check_service
-if [ $? != 0 ]
-then
-  sleep 10
-else
   check_ip
   if [ $? != 0 ]; then check=1; else sleep 10; fi
-fi
 done
+

+ 0 - 1
docker-entrypoint.sh

@@ -1,7 +1,6 @@
 #!/bin/sh
 #set -e
 
-if [ -z ${service} ]; then echo "The service isn't defined!!!"; exit 1; fi
 if [ -z ${vip} ]; then echo "IP isn't defined!!!"; exit 1; fi
 if [ -z ${vin} ]; then echo "NetMASK isn't defined!!!"; exit 1; fi
 if [ -z ${vif} ]; then echo "IF isn't defined!!!"; exit 1; fi