Advertisement
Guest User

Untitled

a guest
Nov 7th, 2012
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. username=your_opendns_username
  4. passwd=your_opendns_password
  5. log_dir=/home/some_user_dir/.opendns
  6.  
  7. if [ ! -d $log_dir ]; then
  8. mkdir $log_dir
  9. fi
  10.  
  11. if [ -e $log_dir/log ]; then
  12. mv $log_dir/log $log_dir/log.1
  13. fi
  14.  
  15. date >> $log_dir/log
  16.  
  17. oldip=`/usr/bin/curl http://nst.sourceforge.net/nst/tools/ip.php -silent -i`
  18.  
  19. while [ 1 ]
  20. do
  21.  
  22. newip=`/usr/bin/curl http://nst.sourceforge.net/nst/tools/ip.php -silent -i`
  23.  
  24. if [ $oldip != $newip ]
  25. then
  26. /usr/bin/curl -i -m 60 -k -u $username:$passwd 'https://updates.opendns.com/account/ddns.php?' -silent >> $log_dir/log
  27. echo -e "\n" >> $log_dir/log
  28. $oldip = $newip
  29. fi
  30.  
  31. sleep 60
  32.  
  33. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement