aboutsummaryrefslogtreecommitdiffstats
path: root/netwatch-dns
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2022-05-12 11:04:43 +0200
committerGravatar Christian Hesse <mail@eworm.de>2022-05-12 11:04:43 +0200
commitdf547b87a47e279d3f6b744675821621eea5d7b8 (patch)
treed5b33fb62e10637d70d8d0616437294ceb15ed9f /netwatch-dns
parent93ec9afe558ef6eba5d513fab359bb5f6618666d (diff)
parent12655bd58afc3a75fe3e2958bbe130b96f8b9be7 (diff)
Merge branch 'ros-v7-path-syntax' into next
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;
}
}