aboutsummaryrefslogtreecommitdiffstats
path: root/netwatch-dns
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2022-05-12 11:03:06 +0200
committerGravatar Christian Hesse <mail@eworm.de>2022-05-12 11:03:06 +0200
commit48f0a2d21118a7bff7d598e84d9f606fb30bf07a (patch)
treefb9746502335552880823e9445cd4201414bb8eb /netwatch-dns
parent93ec9afe558ef6eba5d513fab359bb5f6618666d (diff)
parenta71a3d5466548d05d27d31c446c62afdf2412070 (diff)
Merge branch 'scripts' into ros-v7-path-syntax
Diffstat (limited to 'netwatch-dns')
-rw-r--r--netwatch-dns30
1 files changed, 15 insertions, 15 deletions
diff --git a/netwatch-dns b/netwatch-dns
index e2fcfa3..64c2d8e 100644
--- a/netwatch-dns
+++ b/netwatch-dns
@@ -17,16 +17,16 @@
$ScriptLock $0;
-:if ([ / system resource get uptime ] < 5m) do={
+:if ([ /system/resource/get uptime ] < 5m) do={
$LogPrintExit2 info $0 ("System just booted, giving netwatch some time to settle.") true;
}
:local DnsServers [ :toarray "" ];
:local DnsFallback [ :toarray "" ];
-:local DnsCurrent [ / ip dns get servers ];
+:local DnsCurrent [ /ip/dns/get servers ];
-:foreach Host in=[ / tool netwatch find where comment~"dns" disabled=no ] do={
- :local HostVal [ / tool netwatch get $Host ];
+:foreach Host in=[ /tool/netwatch/find where comment~"dns" disabled=no ] do={
+ :local HostVal [ /tool/netwatch/get $Host ];
:local HostInfo [ $ParseKeyValueStore ($HostVal->"comment") ];
:if ($HostVal->"status" = "up" && $HostInfo->"disabled" != true) do={
@@ -42,24 +42,24 @@ $ScriptLock $0;
:if ([ :len $DnsServers ] > 0) do={
:if ($DnsServers != $DnsCurrent) do={
$LogPrintExit2 info $0 ("Updating DNS servers: " . [ :tostr $DnsServers ]) false;
- / ip dns set servers=$DnsServers;
- / ip dns cache flush;
+ /ip/dns/set servers=$DnsServers;
+ /ip/dns/cache/flush;
}
} else={
:if ([ :len $DnsFallback ] > 0) do={
:if ($DnsFallback != $DnsCurrent) do={
$LogPrintExit2 info $0 ("Updating DNS servers to fallback: " . [ :tostr $DnsFallback ]) false;
- / ip dns set servers=$DnsFallback;
- / ip dns cache flush;
+ /ip/dns/set servers=$DnsFallback;
+ /ip/dns/cache/flush;
}
}
}
:local DohServer "";
-:local DohCurrent [ / ip dns get use-doh-server ];
+:local DohCurrent [ /ip/dns/get use-doh-server ];
-:foreach Host in=[ / tool netwatch find where comment~"doh" disabled=no ] do={
- :local HostVal [ / tool netwatch get $Host ];
+:foreach Host in=[ /tool/netwatch/find where comment~"doh" disabled=no ] do={
+ :local HostVal [ /tool/netwatch/get $Host ];
:local HostInfo [ $ParseKeyValueStore ($HostVal->"comment") ];
:if ($HostVal->"status" = "up" && $HostInfo->"doh" = true && $HostInfo->"disabled" != true && $DohServer = "") do={
@@ -70,13 +70,13 @@ $ScriptLock $0;
:if ($DohServer != "") do={
:if ($DohServer != $DohCurrent) do={
$LogPrintExit2 info $0 ("Updating DoH server: " . $DohServer) false;
- / ip dns set use-doh-server=$DohServer;
- / ip dns cache flush;
+ /ip/dns/set use-doh-server=$DohServer;
+ /ip/dns/cache/flush;
}
} else={
:if ($DohCurrent != "") do={
$LogPrintExit2 info $0 ("DoH server (" . $DohCurrent . ") is down, disabling.") false;
- / ip dns set use-doh-server="";
- / ip dns cache flush;
+ /ip/dns/set use-doh-server="";
+ /ip/dns/cache/flush;
}
}