★nslookupシェルスクリプト
・chk_dns.sh
PERL:
-
#-------------------------------------------------
-
# ■nslookupシェルスクリプト
-
#-------------------------------------------------
-
-
# 環境ごとに設定(要変更)---------------------------------
-
log_save_path='/chk_dns/log/'
-
log_file_name="${log_save_path}$(date +%Y%m%d ).log"
-
dns_server='8.8.8.8'
-
chk_domain_ip='www.yahoo.co.jp'
-
-
# 処理内容(必要に応じて変更)---------------------------------------
-
echo '------------------------------'>> $log_file_name
-
date +"%Y/%m/%d %k:%M:%S">> $log_file_name
-
echo '------------------------------'>> $log_file_name
-
-
echo "*** nslookup $chk_domain_ip $dns_server ***">> $log_file_name
-
nslookup $chk_domain_ip $dns_server>> $log_file_name
★結果
------------------------------ 2013/11/02 20:27:01 ------------------------------ *** nslookup www.yahoo.co.jp 8.8.8.8 *** Server: 8.8.8.8 Address: 8.8.8.8#53 Non-authoritative answer: www.yahoo.co.jp canonical name = www.g.yahoo.co.jp. Name: www.g.yahoo.co.jp Address: 124.83.179.227