Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :global ddnsuser "USER"
- :global ddnspass "PASS"
- :global ddnshost "MEUHOST.COM.SEILA"
- :global waninterface "NOME_DA_INTERFACE_QUE_CONECTA_NA_INTERNET"
- :global ddnsserver "SERVIDOR_QUE_ATUALIZA_OS_HOSTS"
- :global ipddns [:resolve $ddnshost];
- :global ipfreshwithmask [ /ip address get [/ip address find interface=$waninterface ] address ]
- :global ipfresh [ :pick $ipfreshwithmask 0 [ :find $ipfreshwithmask "/" ] ]
- # ----------------------------------------------------------------------------------------------
- :log info ("DDNS: Iniciando script.")
- :if ([ :typeof $ipfresh ] = "nothing" ) do={
- :log info ("DDNS: Interface '$waninterface' sem Ip.")
- :quit
- }
- :if ($ipddns != $ipfresh) do={
- :log info ("DDNS: Ip alterado de $ipddns para $ipfresh")
- :log info "DDNS: Atualizando Ip no servior ...!"
- :global url "$ddnsserver/nic/update\?hostname=$ddnshost&myip=$ipfresh&username=$ddnsuser&password=$ddnspass"
- /tool fetch url=$url mode=https dst-path=DDNS
- /file remove [/file find name="DDNS"];
- :delay 5s
- } else={
- :log info "DDNS: Nenhuma mudança para fazer.";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement