首頁 繪圖設計 工作閒聊 比賽活動 美術討論 標籤 圖片
DNS Propagation status checker Bash Script w/ nslookup
DNS Propagation status checker Bash Script w/ nslookup




Type(Type) 2017/4/23 22:34

DNS Propagation status checker Bash Script



Some DNS server might "dance" when you change your IP address, here comes a bash script to check with NSLOOKUP status and do status accumulation.


代碼:

#!/bin/bash
#
# dns propagation status checker script
#

new=0
old=0

hostname='YOUR.HOSTNAME.COM'

dns_server1='168.95.1.1'
dns_server2='8.8.8.8'

old_ip_address='XXX.XXX.XXX.XXX'
new_ip_address='YYY.YYY.YYY.YYY'


while [ "1" == "1" ]
do
    h=`nslookup $hostname $dns_server1 | tail -2 | head -1 | awk '{print $2}'`
    s=`nslookup $hostname $dns_server2 | tail -2 | head -1 | awk '{print $2}'`
    sleep 1
    if [ "$s" == "$new_ip_address" ]
    then
        new=`echo "$new + 1" | bc`
    fi
    if [ "$h" == "$new_ip_address" ]
    then
        new=`echo "$new + 1" | bc`
    fi
    if [ "$s" == "$old_ip_address" ]
    then
        old=`echo "$old + 1" | bc`
    fi
    if [ "$h" == "$old_ip_address" ]
    then
        old=`echo "$old + 1" | bc`
    fi

    echo "New: $new     Old: $old"
done


(976 views)
[更多討論] 討論區 Windows, Linux, Perl, PHP, C/C++, Driver, Web 理論、應用、硬體、軟體




"DNS Propagation status checker Bash Script w/ nslookup" 傳統頁面(電腦版)

首頁 繪圖設計 工作閒聊 比賽活動 美術討論 標籤 圖片
傳統桌面版 [ 登入/註冊 ]
© Vovo2000.com Mobile Version 小哈手機版 2018