|
@@ -20,12 +20,16 @@ else
|
|
|
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)
|
|
|
-
|
|
|
- service_index=$(nslookup ${node_ip}|grep "in-addr.arpa"|cut -d " " -f3|cut -d "." -f2)
|
|
|
-
|
|
|
- time_to_dead=$((service_index*180+curtime))
|
|
|
- echo ${time_to_dead} > /tmp/dead
|
|
|
+ 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
|
|
|
+ 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;exit 0;fi
|
|
|
+ done
|
|
|
fi
|
|
|
fi
|