mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
dhcp-to-dns: add cname if host name appears for existing record
This commit is contained in:
parent
b22a84ed0f
commit
40f0d54ea8
1 changed files with 4 additions and 0 deletions
|
@ -83,6 +83,10 @@ $ScriptLock $0 false 10;
|
|||
}
|
||||
|
||||
:local Cname [ /ip/dns/static/find where type=CNAME cname=($MacDash . "." . $Domain) comment=$Comment ];
|
||||
:if ([ :len $Cname ] = 0 && [ :len $HostName ] > 0) do={
|
||||
$LogPrintExit2 info $0 ("Host name appeared, adding CNAME " . ($HostName . "." . $Domain) . " pointing to " . ($MacDash . "." . $Domain) . ".") false;
|
||||
/ip/dns/static/add name=($HostName . "." . $Domain) type=CNAME cname=($MacDash . "." . $Domain) ttl=$Ttl comment=$Comment place-before=$PlaceBefore;
|
||||
}
|
||||
:if ([ :len $Cname ] > 0 && [ /ip/dns/static/get $Cname name ] != ($HostName . "." . $Domain)) do={
|
||||
$LogPrintExit2 info $0 ("Host name changed, updating CNAME (pointing to " . ($MacDash . "." . $Domain) . ") to " . ($HostName . "." . $Domain) . ".") false;
|
||||
/ip/dns/static/set name=($HostName . "." . $Domain) $Cname;
|
||||
|
|
Loading…
Reference in a new issue