Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. :local dmeuser "user@email.com"
  2. :local ddnsid "1234567"
  3. :local ddnspassword "recordpassword"
  4.  
  5. # Name of the public/external interface
  6.  
  7. :local inetinterface "ether1-gateway"
  8. :global oldIP;
  9.  
  10. :if ([/interface get $inetinterface value-name=running]) do={
  11. :local currentIP [/ip address get [find interface="$inetinterface" disabled=no] address];
  12.  
  13. # Strip the net mask off the IP address
  14. :for i from=( [:len $currentIP] - 1) to=0 do={
  15. :if ( [:pick $currentIP $i] = "/") do={
  16. :set currentIP [:pick $currentIP 0 $i]
  17. }
  18. }
  19.  
  20. :if ($currentIP != $oldIP) do={
  21. :set oldIP $currentIP
  22. :local url "http://www.dnsmadeeasy.com/servlet/updateip\3F&username=$dmeuser&password=$ddnspassword&id=$ddnsid&ip=$currentIP"
  23. /tool fetch url=($url) mode=http dst-path=("dmeupdate-" . $ddnsid . ".txt")
  24. :log info "DNSMadeEasy: Record $ddnsid updated to $currentIP"
  25. }
  26. } else={
  27. :log info "DNSMadeEasy: $inetinterface is not currently running."
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement