2013年9月7日

檢查網址 IP 有無變動並紀錄

簡單的 Shell Script , 用來 check 某網址 ip 有無變動,有的話紀錄在檔案內


#!/bin/bash
old=`tail -n1 IP.txt`
new=`nslookup www.google.com | grep -A1 google | grep Address | awk '{print $2}'`
if [ "$new" != "$old" ];then
   date >> IP.txt
   echo $new >> IP.txt
fi

0 意見:

張貼留言