[精讚] [會員登入]
722

[shell script] 批次判斷domain name 正解設定

判斷dns 正解設定

分享此文連結 //n.sfs.tw/14790

分享連結 [shell script] 批次判斷domain name 正解設定@igogo
(文章歡迎轉載,務必尊重版權註明連結來源)
2020-11-04 15:29:43 最後編修
2020-10-30 14:54:31 By igogo
 

 

 

這是一段描述如何找出名單中已成功設定domain name 指向 140.128.53.34 的script

ipv4

#!/bin/bash
filename='list.txt'

exec < $filename

while read line
do
        nslookup $line | grep 140.128.53.34
        if [ $? == 0 ]
        then
                echo $line >> ok_result.txt
        fi
        sleep 1
done

 

grep 符合字串成功的回傳值為 0

藉由 $?  可以得知回傳值

 

ipv6 使用dig

#!/bin/bash
filename="list.txt"
ipv6="2001:288:5400:d::34"

exec < $filename

while read line
do
        #dig lxes.tc.edu.tw AAAA | grep 2001:288:5400:d::34
        dig $line "AAAA"| grep $ipv6
        if [ $? == 0 ]
        then
                echo $line >> ok_result6.txt
        fi
        sleep 0.5
done

 

 

END

你可能感興趣的文章

臺中市雲端校務系統與Windows AD帳號整合(6) 修改Windows AD 密碼原則

mongo備份指令 mongodump --host localhost --port 27017 --username root --db

利用openssl 一行文產生私鑰及憑證請求檔 openssl 一行產生私鑰及憑證請求檔

臺中市雲端校務系統與Windows AD帳號整合(9) 3-2 Linux上隨系統開機啟動服務 以Centos 7 發行版為例 請注意, 此時提供服務的主机為Linux, 所以

windows 使用 command 移除程式 使用 command 移除程式

使用expect 讀取外部資料存成陣列 使用expect 讀取外部資料存成陣列

隨機好文

[vue.js] 設定 content type 今天在wickt 端怎麼就是收不到vue.js 以post 傳過來的資料 找了好久才發現 application/jso

[vue.js] input event Form-Input-Components-using-Custom-Events

臺中市雲端校務系統與Windows AD帳號整合(5) 安裝java環境

Google sheet 建立成績單的總分及排名並提供名字下拉查詢 Google sheet, sum, rank, pull down list

刪除資料夾內的檔案 lambda 一行文 Arrays.stream(new File("/folder/path").