Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. # detects if IP behinds the dns has changed
  2. new_ip_addr=''
  3. old_ip_addr=''
  4.  
  5. while(true);
  6. do
  7. new_ip_addr=`nslookup example.com | grep Address | tail -1 | awk '{print $2}'`;
  8. echo $new_ip_addr;
  9. if [ $new_ip_addr!==$old_ip_addr ];
  10. then
  11. echo `date` $new_ip_addr;
  12.  
  13. # making old and new ip same
  14. old_ip_addr=$new_ip_addr
  15. echo $new_ip_addr;
  16. echo $old_ip_addr;
  17. fi
  18.  
  19. sleep 5;
  20. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement