Argomento: mikrotik script
Mikrotik script not work 4 me. Where I am wrong ?
:global ddnsuser drdado
:global ddnspass mypassword
:global theinterface wan
:global ddnshost drdado
:global ipddns [:resolve $ddnshost];
:global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]
:if ([ :typeof $ipfresh ] = nil ) do={
:log info ("dynu: No ip address on $theinterface .")
} else={
:for i from=( [:len $ipfresh] - 1) to=0 do={
:if ( [:pick $ipfresh $i] = "/") do={
:set ipfresh [:pick $ipfresh 0 $i];
}
}
:if ($ipddns != $ipfresh) do={
:log info ("dynu: IP-dynu = $ipddns")
:log info ("dynu: IP-Fresh = $ipfresh")
:log info "dynu: Update IP needed, Sending UPDATE...!"
:global str "/nic/update?hostname=$ddnshost&myip=$ipfresh"
/tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/Dynu.".$ddnshost)
:delay 1
:global str [/file find name="Dynu.$ddnshost"];
/file remove $str
:global ipddns $ipfresh
:log info "dynu: IP updated to $ipfresh!"
} else={
:log info "dynu: dont need changes";
}
}
:global ddnsuser drdado
:global ddnspass mypassword
:global theinterface wan
:global ddnshost drdado
:global ipddns [:resolve $ddnshost];
:global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]
:if ([ :typeof $ipfresh ] = nil ) do={
:log info ("dynu: No ip address on $theinterface .")
} else={
:for i from=( [:len $ipfresh] - 1) to=0 do={
:if ( [:pick $ipfresh $i] = "/") do={
:set ipfresh [:pick $ipfresh 0 $i];
}
}
:if ($ipddns != $ipfresh) do={
:log info ("dynu: IP-dynu = $ipddns")
:log info ("dynu: IP-Fresh = $ipfresh")
:log info "dynu: Update IP needed, Sending UPDATE...!"
:global str "/nic/update?hostname=$ddnshost&myip=$ipfresh"
/tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/Dynu.".$ddnshost)
:delay 1
:global str [/file find name="Dynu.$ddnshost"];
/file remove $str
:global ipddns $ipfresh
:log info "dynu: IP updated to $ipfresh!"
} else={
:log info "dynu: dont need changes";
}
}
Rispondi con citazione |Segnalare
:global ddnshost drdado
The ddnshost is not your username, it should be your hostname/domain name.
The ddnshost is not your username, it should be your hostname/domain name.
Rispondi con citazione |Segnalare
| Autore | Argomento: mikrotik script |
|---|---|
|
drdado Iscritto: 08/06/2015 |
mercoledì 30 gennaio 2019 11:39
Mikrotik script not work 4 me. Where I am wrong ?
:global ddnsuser drdado :global ddnspass mypassword :global theinterface wan :global ddnshost drdado :global ipddns [:resolve $ddnshost]; :global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ] :if ([ :typeof $ipfresh ] = nil ) do={ :log info ("dynu: No ip address on $theinterface .") } else={ :for i from=( [:len $ipfresh] - 1) to=0 do={ :if ( [:pick $ipfresh $i] = "/") do={ :set ipfresh [:pick $ipfresh 0 $i]; } } :if ($ipddns != $ipfresh) do={ :log info ("dynu: IP-dynu = $ipddns") :log info ("dynu: IP-Fresh = $ipfresh") :log info "dynu: Update IP needed, Sending UPDATE...!" :global str "/nic/update?hostname=$ddnshost&myip=$ipfresh" /tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/Dynu.".$ddnshost) :delay 1 :global str [/file find name="Dynu.$ddnshost"]; /file remove $str :global ipddns $ipfresh :log info "dynu: IP updated to $ipfresh!" } else={ :log info "dynu: dont need changes"; } } |
|
armo Iscritto: 23/06/2017 |
lunedì 11 febbraio 2019 20:32
:global ddnshost drdado
The ddnshost is not your username, it should be your hostname/domain name. |
sabato 13 giugno 2026 06:28
