|
@@ -11,26 +11,20 @@ curl -f -H 'Host:demo.infoclinica.ru' 127.0.0.1:9000/login || exit 1
|
|
|
|
|
|
|
|
|
if [ -f /tmp/dead ];then
|
|
|
- dead_to_time=$(cat /tmp/dead)
|
|
|
- if (( ${curtime} > ${dead_to_time} ));then kill 1;fi
|
|
|
+
|
|
|
+ if (( ${curtime} > $(cat /tmp/dead) ));then kill 1;fi
|
|
|
else
|
|
|
|
|
|
ping -c3 $(cat /tmp/admin_ip)
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
- new_admin_ip=$(nslookup ${ADMIN_HOST}.${APPNET}|grep Address|tail -n1|cut -d " " -f2)
|
|
|
+ new_admin_ip=$(dig +short ${ADMIN_HOST}.${APPNET})
|
|
|
if [[ ${new_admin_ip} != $(cat /tmp/admin_ip) ]];then
|
|
|
ping -c3 ${new_admin_ip} || exit 0
|
|
|
fi
|
|
|
-
|
|
|
- node_ip=$(nslookup ${HOSTNAME}.${APPNET}|grep Address|tail -n +2|cut -d " " -f2)
|
|
|
- last_node_oct=$(echo ${node_ip}|cut -d "." -f4)
|
|
|
-
|
|
|
- last_task_node_oct=($(echo $(nslookup tasks.${SERVICE_NAME}.${APPNET}|grep Address|tail -n +2|cut -d " " -f2|cut -d "." -f4)))
|
|
|
- IFS=$'\n' sorted=($(sort <<<"${last_task_node_oct[*]}"))
|
|
|
- unset IFS
|
|
|
+ sorted=($(echo $(dig tasks.${SERVICE_NAME}.${APPNET} +short)|sort -n))
|
|
|
for i in ${!sorted[*]}
|
|
|
do
|
|
|
- if [[ ${last_node_oct} -eq ${sorted[i]} ]];then time_to_dead=$((i*180+curtime+30));echo "${time_to_dead}" > /tmp/dead;fi
|
|
|
+ if [[ ${sorted[${i}]} == $(dig ${HOSTNAME}.${APPNET} +short) ]];then time_to_dead=$((${i}*180+${curtime}+20));echo "${time_to_dead}" > /tmp/dead;fi
|
|
|
done
|
|
|
fi
|
|
|
fi
|