mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
netwatch-dns: flush cache on configuration change
This commit is contained in:
parent
0b46c508dc
commit
a47f5723cc
1 changed files with 4 additions and 0 deletions
|
@ -43,12 +43,14 @@ $ScriptLock $0;
|
||||||
:if ($DnsServers != $DnsCurrent) do={
|
:if ($DnsServers != $DnsCurrent) do={
|
||||||
$LogPrintExit2 info $0 ("Updating DNS servers: " . [ :tostr $DnsServers ]) false;
|
$LogPrintExit2 info $0 ("Updating DNS servers: " . [ :tostr $DnsServers ]) false;
|
||||||
/ ip dns set servers=$DnsServers;
|
/ ip dns set servers=$DnsServers;
|
||||||
|
/ ip dns cache flush;
|
||||||
}
|
}
|
||||||
} else={
|
} else={
|
||||||
:if ([ :len $DnsFallback ] > 0) do={
|
:if ([ :len $DnsFallback ] > 0) do={
|
||||||
:if ($DnsFallback != $DnsCurrent) do={
|
:if ($DnsFallback != $DnsCurrent) do={
|
||||||
$LogPrintExit2 info $0 ("Updating DNS servers to fallback: " . [ :tostr $DnsFallback ]) false;
|
$LogPrintExit2 info $0 ("Updating DNS servers to fallback: " . [ :tostr $DnsFallback ]) false;
|
||||||
/ ip dns set servers=$DnsFallback;
|
/ ip dns set servers=$DnsFallback;
|
||||||
|
/ ip dns cache flush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,10 +71,12 @@ $ScriptLock $0;
|
||||||
:if ($DohServer != $DohCurrent) do={
|
:if ($DohServer != $DohCurrent) do={
|
||||||
$LogPrintExit2 info $0 ("Updating DoH server: " . $DohServer) false;
|
$LogPrintExit2 info $0 ("Updating DoH server: " . $DohServer) false;
|
||||||
/ ip dns set use-doh-server=$DohServer;
|
/ ip dns set use-doh-server=$DohServer;
|
||||||
|
/ ip dns cache flush;
|
||||||
}
|
}
|
||||||
} else={
|
} else={
|
||||||
:if ($DohCurrent != "") do={
|
:if ($DohCurrent != "") do={
|
||||||
$LogPrintExit2 info $0 ("DoH server (" . $DohCurrent . ") is down, disabling.") false;
|
$LogPrintExit2 info $0 ("DoH server (" . $DohCurrent . ") is down, disabling.") false;
|
||||||
/ ip dns set use-doh-server="";
|
/ ip dns set use-doh-server="";
|
||||||
|
/ ip dns cache flush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue