|
@@ -8,3 +8,30 @@ if (( curtime-containerstart < 180 )); then
|
|
|
fi
|
|
|
|
|
|
curl -f -H 'Host:demo.infoclinica.ru' 127.0.0.1:9000/login || exit 1
|
|
|
+
|
|
|
+
|
|
|
+if [ -f /tmp/dead ];then
|
|
|
+ if (( curtime > $(cat /tmp/dead) )); then kill 1;fi
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+ping -c3 $(cat /tmp/admin_ip)
|
|
|
+if [[ $? -ne 0 ]]; then
|
|
|
+ new_admin_ip=$(nslookup ${ADMIN_HOST}.${APPNET}|grep Address|tail -n1|cut -d " " -f2)
|
|
|
+ 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)
|
|
|
+
|
|
|
+ service_name=$(nslookup ${node_ip}|grep "in-addr.arpa"|cut -d " " -f3|cut -d "." -f1)
|
|
|
+
|
|
|
+ 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
|
|
|
+ for i in ${!sorted[*]}
|
|
|
+ do
|
|
|
+ if [[ ${last_node_oct} -eq ${sorted[i]} ]];then : $((time_to_dead=${i}*180+curtime));echo ${time_to_dead} > /tmp/dead;fi
|
|
|
+ done
|
|
|
+fi
|