5 IFS=, HOSTS=($HOSTNAME)
8 if [ -z "$SLEEP" ] ; then
19 new_ip_address=$(curl -4 $URL | sed 's/[ \t\n]*$//')
21 result=$(whois $new_ip_address)
26 # Ignoring, if after mobile NAT
27 cnt=`echo "$result" | grep descr | grep -i 'beeline\|mts\|megafon' | wc -l`
31 echo "Mobile NAT detected, backup channel, no action taken"
35 if [ -z "$new_ip_address" ] ; then
40 if [ -z "$old_ip_address" ] ; then
41 old_ip_address=$(host -W 1 -R 4 -4 -t A $MAINHOST $SERVER | grep "has address" | awk '{print $4}')
42 old_ip_address=$(echo $old_ip_address)
43 if [ -z "$old_ip_address" ] ; then
49 echo "[$old_ip_address],[$new_ip_address]"
51 if [ "$old_ip_address" = "$new_ip_address" ] ; then
53 echo "IP not changed, no action"
57 for host in ${HOSTS[@]}; do
58 nsupdate -v -k $KEYFILE << EOF
62 update add $host $TTL A $new_ip_address
66 echo "DNS update for $host"