Advertisement
Guest User

Untitled

a guest
Jun 11th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. :global ddnsuser "USER"
  2. :global ddnspass "PASS"
  3. :global ddnshost "MEUHOST.COM.SEILA"
  4. :global waninterface "NOME_DA_INTERFACE_QUE_CONECTA_NA_INTERNET"
  5.  
  6. :global ddnsserver "SERVIDOR_QUE_ATUALIZA_OS_HOSTS"
  7.  
  8. :global ipddns [:resolve $ddnshost];
  9. :global ipfreshwithmask [ /ip address get [/ip address find interface=$waninterface ] address ]
  10. :global ipfresh [ :pick $ipfreshwithmask 0 [ :find $ipfreshwithmask "/" ] ]
  11.  
  12. # ----------------------------------------------------------------------------------------------
  13.  
  14. :log info ("DDNS: Iniciando script.")
  15.  
  16. :if ([ :typeof $ipfresh ] = "nothing" ) do={
  17. :log info ("DDNS: Interface '$waninterface' sem Ip.")
  18. :quit
  19. }
  20.  
  21. :if ($ipddns != $ipfresh) do={
  22. :log info ("DDNS: Ip alterado de $ipddns para $ipfresh")
  23. :log info "DDNS: Atualizando Ip no servior ...!"
  24.  
  25. :global url "$ddnsserver/nic/update\?hostname=$ddnshost&myip=$ipfresh&username=$ddnsuser&password=$ddnspass"
  26. /tool fetch url=$url mode=https dst-path=DDNS
  27. /file remove [/file find name="DDNS"];
  28.  
  29. :delay 5s
  30.  
  31. } else={
  32. :log info "DDNS: Nenhuma mudança para fazer.";
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement