Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # detects if IP behinds the dns has changed
- new_ip_addr=''
- old_ip_addr=''
- while(true);
- do
- new_ip_addr=`nslookup example.com | grep Address | tail -1 | awk '{print $2}'`;
- echo $new_ip_addr;
- if [ $new_ip_addr!==$old_ip_addr ];
- then
- echo `date` $new_ip_addr;
- # making old and new ip same
- old_ip_addr=$new_ip_addr
- echo $new_ip_addr;
- echo $old_ip_addr;
- fi
- sleep 5;
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement