Merge branch 'no-error-on-exit' into next

This commit is contained in:
Christian Hesse 2024-03-04 17:54:28 +01:00
commit c462c0b598
57 changed files with 210 additions and 80 deletions

View file

@ -30,7 +30,9 @@
:global SymbolForNotification;
:global WaitFullyConnected;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
:if ([ $ScriptFromTerminal $ScriptName ] = false && $BackupRandomDelay > 0) do={

View file

@ -45,7 +45,9 @@
$LogPrintExit2 error $ScriptName ("Configured to send neither backup nor config export.") true;
}
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
:if ([ $ScriptFromTerminal $ScriptName ] = false && $BackupRandomDelay > 0) do={

View file

@ -18,7 +18,9 @@
:global LogPrintExit2;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:if ([ :len [ /partitions/find ] ] < 2) do={
$LogPrintExit2 error $ScriptName ("Device does not have a fallback partition.") true;

View file

@ -44,7 +44,9 @@
$LogPrintExit2 error $ScriptName ("Configured to send neither backup nor config export.") true;
}
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
:if ([ $ScriptFromTerminal $ScriptName ] = false && $BackupRandomDelay > 0) do={

View file

@ -24,7 +24,9 @@
:global ScriptLock;
:global WaitFullyConnected;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
:local PackagePath [ $CleanFilePath [ /caps-man/manager/get package-path ] ];

View file

@ -25,7 +25,9 @@
:global ScriptLock;
:global WaitFullyConnected;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
:local PackagePath [ $CleanFilePath [ /caps-man/manager/get package-path ] ];

View file

@ -24,7 +24,9 @@
:global ScriptLock;
:global WaitFullyConnected;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
:local PackagePath [ $CleanFilePath [ /interface/wifi/capsman/get package-path ] ];

View file

@ -24,7 +24,9 @@
:global ScriptLock;
:global WaitFullyConnected;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
:local PackagePath [ $CleanFilePath [ /interface/wifiwave2/capsman/get package-path ] ];

View file

@ -21,7 +21,9 @@
:global LogPrintExit2;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:local InstalledVersion [ /system/package/update/get installed-version ];

View file

@ -22,7 +22,9 @@
:global LogPrintExit2;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:local InstalledVersion [ /system/package/update/get installed-version ];

View file

@ -21,7 +21,9 @@
:global LogPrintExit2;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:local InstalledVersion [ /system/package/update/get installed-version ];

View file

@ -21,7 +21,9 @@
:global LogPrintExit2;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:local InstalledVersion [ /system/package/update/get installed-version ];

View file

@ -20,7 +20,9 @@
:global MkDir;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:foreach Cert in=[ /certificate/find where issued expires-after<3w ] do={
:local CertVal [ /certificate/get $Cert ];

View file

@ -127,7 +127,9 @@
[ $FormatLine "Expires in" [ $IfThenElse (($CertVal->"expired") = true) "expired" [ $FormatExpire ($CertVal->"expires-after") ] ] ]);
}
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
:foreach Cert in=[ /certificate/find where !revoked !ca !scep-url expires-after<$CertRenewTime ] do={

View file

@ -39,7 +39,9 @@
:return ($T->0 * 10 + $T->1);
}
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:local Resource [ /system/resource/get ];
@ -75,7 +77,8 @@
}
:if ([ :len [ /system/health/find ] ] = 0) do={
$LogPrintExit2 debug $ScriptName ("Your device does not provide any health values.") true;
$LogPrintExit2 debug $ScriptName ("Your device does not provide any health values.") false;
:return true;
}
:if ([ :typeof $CheckHealthLast ] != "array") do={

View file

@ -18,7 +18,9 @@
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:if ([ :typeof $SentLteFirmwareUpgradeNotification ] != "array") do={
:global SentLteFirmwareUpgradeNotification ({});

View file

@ -41,7 +41,9 @@
:error "Waiting for system to reboot.";
}
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
:if ([ :len [ /system/scheduler/find where name="_RebootForUpdate" ] ] > 0) do={
@ -53,7 +55,8 @@
:local Update [ /system/package/update/get ];
:if ([ $ScriptFromTerminal $ScriptName ] = true && ($Update->"installed-version") = ($Update->"latest-version")) do={
$LogPrintExit2 info $ScriptName ("System is already up to date.") true;
$LogPrintExit2 info $ScriptName ("System is already up to date.") false;
:return true;
}
:local NumInstalled [ $VersionToNum ($Update->"installed-version") ];
@ -129,7 +132,8 @@
:if ($SentRouterosUpdateNotification = $Update->"latest-version") do={
$LogPrintExit2 info $ScriptName ("Already sent the RouterOS update notification for version " . \
$Update->"latest-version" . ".") true;
$Update->"latest-version" . ".") false;
:return true;
}
$SendNotification2 ({ origin=$ScriptName; \
@ -143,7 +147,8 @@
:if ($NumInstalled > $NumLatest) do={
:if ($SentRouterosUpdateNotification = $Update->"latest-version") do={
$LogPrintExit2 info $ScriptName ("Already sent the RouterOS downgrade notification for version " . \
$Update->"latest-version" . ".") true;
$Update->"latest-version" . ".") false;
:return true;
}
$SendNotification2 ({ origin=$ScriptName; \

View file

@ -28,7 +28,9 @@
:global SendNotification2;
:global SymbolForNotification;
$ScriptLock $ScriptName false 10;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false;
}
:if ([ :len [ /caps-man/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={
/caps-man/access-list/add comment="--- collected above ---" disabled=yes;

View file

@ -28,7 +28,9 @@
:global SendNotification2;
:global SymbolForNotification;
$ScriptLock $ScriptName false 10;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false;
}
:if ([ :len [ /interface/wireless/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={
/interface/wireless/access-list/add comment="--- collected above ---" disabled=yes;

View file

@ -29,7 +29,9 @@
:global SendNotification2;
:global SymbolForNotification;
$ScriptLock $ScriptName false 10;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false;
}
:if ([ :len [ /caps-man/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={
:if ([ :len [ /interface/wifi/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={

View file

@ -28,7 +28,9 @@
:global SendNotification2;
:global SymbolForNotification;
$ScriptLock $ScriptName false 10;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false;
}
:if ([ :len [ /interface/wifi/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={
/interface/wifi/access-list/add comment="--- collected above ---" disabled=yes;

View file

@ -28,7 +28,9 @@
:global SendNotification2;
:global SymbolForNotification;
$ScriptLock $ScriptName false 10;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false;
}
:if ([ :len [ /interface/wifiwave2/access-list/find where comment="--- collected above ---" disabled ] ] = 0) do={
/interface/wifiwave2/access-list/add comment="--- collected above ---" disabled=yes;

View file

@ -30,7 +30,9 @@
:global WaitForFile;
:global WaitFullyConnected;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
# return pseudo-random string for PSK

View file

@ -30,7 +30,9 @@
:global WaitForFile;
:global WaitFullyConnected;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
# return pseudo-random string for PSK

View file

@ -31,7 +31,9 @@
:global WaitForFile;
:global WaitFullyConnected;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
# return pseudo-random string for PSK

View file

@ -30,7 +30,9 @@
:global WaitForFile;
:global WaitFullyConnected;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
# return pseudo-random string for PSK

View file

@ -30,7 +30,9 @@
:global WaitForFile;
:global WaitFullyConnected;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
# return pseudo-random string for PSK

View file

@ -20,7 +20,9 @@
:global LogPrintExit2;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic=yes status=bound ] do={
:local LeaseVal [ /ip/dhcp-server/lease/get $Lease ];

View file

@ -20,7 +20,9 @@
:global LogPrintExit2;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic=yes status=bound ] do={
:local LeaseVal [ /ip/dhcp-server/lease/get $Lease ];

View file

@ -21,7 +21,9 @@
:global LogPrintExit2;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic=yes status=bound ] do={
:local LeaseVal [ /ip/dhcp-server/lease/get $Lease ];

View file

@ -20,7 +20,9 @@
:global LogPrintExit2;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic=yes status=bound ] do={
:local LeaseVal [ /ip/dhcp-server/lease/get $Lease ];

View file

@ -20,7 +20,9 @@
:global LogPrintExit2;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:foreach Lease in=[ /ip/dhcp-server/lease/find where dynamic=yes status=bound ] do={
:local LeaseVal [ /ip/dhcp-server/lease/get $Lease ];

View file

@ -26,7 +26,9 @@
:global ParseKeyValueStore;
:global ScriptLock;
$ScriptLock $ScriptName false 10;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false;
}
:local Ttl 5m;
:local CommentPrefix ("managed by " . $ScriptName);

View file

@ -18,15 +18,19 @@
:global ScriptLock;
:global VersionToNum;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:local RouterBoard [ /system/routerboard/get ];
:if ($RouterBoard->"current-firmware" = $RouterBoard->"upgrade-firmware") do={
$LogPrintExit2 info $ScriptName ("Current and upgrade firmware match with version " . \
$RouterBoard->"current-firmware" . ".") true;
$RouterBoard->"current-firmware" . ".") false;
:return true;
}
:if ([ $VersionToNum ($RouterBoard->"current-firmware") ] > [ $VersionToNum ($RouterBoard->"upgrade-firmware") ]) do={
$LogPrintExit2 info $ScriptName ("Different firmware version is available, but it is a downgrade. Ignoring.") true;
$LogPrintExit2 info $ScriptName ("Different firmware version is available, but it is a downgrade. Ignoring.") false;
:return true;
}
:if ([ /system/routerboard/settings/get auto-upgrade ] = false) do={

View file

@ -34,7 +34,9 @@
}
}
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
:local ListComment ("managed by " . $ScriptName);

View file

@ -328,7 +328,8 @@
}
:if ([ $CertificateAvailable "R3" ] = false) do={
$LogPrintExit2 error $0 ("Downloading required certificate failed.") true;
$LogPrintExit2 error $0 ("Downloading required certificate failed.") false;
:return false;
}
:local Url ("https://upgrade.mikrotik.com/routeros/" . $PkgVer . "/" . $PkgFile);
@ -1169,8 +1170,7 @@
# lock script against multiple invocation
:set ScriptLock do={
:local Script [ :tostr $1 ];
:local DoReturn $2;
:local WaitMax ([ :tonum $3 ] * 10);
:local WaitMax ([ :tonum $3 ] * 10);
:global GetRandom20CharAlNum;
:global IfThenElse;
@ -1285,13 +1285,13 @@
:if ([ $IsFirstTicket $Script $MyTicket ] = true && [ $TicketCount $Script ] = [ $JobCount $Script ]) do={
$RemoveTicket $Script $MyTicket;
$CleanupTickets $Script;
:return false;
:return true;
}
$RemoveTicket $Script $MyTicket;
$LogPrintExit2 info $0 ("Script '" . $Script . "' started more than once" . [ $IfThenElse ($WaitCount > 0) \
" and timed out waiting for lock" "" ] . "... Aborting.") [ $IfThenElse ($DoReturn = true) false true ];
:return true;
" and timed out waiting for lock" "" ] . "...") false;
:return false;
}
# send notification via NotificationFunctions - expects at least two string arguments

View file

@ -21,7 +21,9 @@
:global ScriptLock;
:global WaitFullyConnected;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;
:local CoordinateFormat [ /system/gps/get coordinate-format ];

View file

@ -22,7 +22,9 @@
:global ParseKeyValueStore;
:global ScriptLock;
$ScriptLock $ScriptName false 10;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false;
}
:local DHCPServers ({});
:foreach Server in=[ /ip/dhcp-server/find where comment~"hotspot-to-wpa" ] do={

View file

@ -23,7 +23,9 @@
:global ParseKeyValueStore;
:global ScriptLock;
$ScriptLock $ScriptName false 10;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false;
}
:local DHCPServers ({});
:foreach Server in=[ /ip/dhcp-server/find where comment~"hotspot-to-wpa" ] do={

View file

@ -22,7 +22,9 @@
:global ParseKeyValueStore;
:global ScriptLock;
$ScriptLock $ScriptName false 10;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false;
}
:local DHCPServers ({});
:foreach Server in=[ /ip/dhcp-server/find where comment~"hotspot-to-wpa" ] do={

View file

@ -22,7 +22,9 @@
:global ParseKeyValueStore;
:global ScriptLock;
$ScriptLock $ScriptName false 10;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false;
}
:local DHCPServers ({});
:foreach Server in=[ /ip/dhcp-server/find where comment~"hotspot-to-wpa" ] do={

View file

@ -23,7 +23,9 @@
:global ParseKeyValueStore;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:if ([ :len $MacAddress ] = 0 || [ :len $UserName ] = 0) do={
$LogPrintExit2 error $ScriptName ("This script is supposed to run from hotspot on login.") true;
@ -52,7 +54,8 @@
comment=("hotspot-to-wpa template " . $Hotspot) disabled ]->0) ];
:if ($Template->"action" = "reject") do={
$LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") true;
$LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") false;
:return true;
}
# allow login page to load

View file

@ -24,7 +24,9 @@
:global ParseKeyValueStore;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:if ([ :len $MacAddress ] = 0 || [ :len $UserName ] = 0) do={
$LogPrintExit2 error $ScriptName ("This script is supposed to run from hotspot on login.") true;
@ -65,7 +67,8 @@
comment=("hotspot-to-wpa template " . $Hotspot) disabled ]->0) ];
:if ($Template->"action" = "reject") do={
$LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") true;
$LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") false;
:return true;
}
# allow login page to load

View file

@ -23,7 +23,9 @@
:global ParseKeyValueStore;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:if ([ :len $MacAddress ] = 0 || [ :len $UserName ] = 0) do={
$LogPrintExit2 error $ScriptName ("This script is supposed to run from hotspot on login.") true;
@ -52,7 +54,8 @@
comment=("hotspot-to-wpa template " . $Hotspot) disabled ]->0) ];
:if ($Template->"action" = "reject") do={
$LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") true;
$LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") false;
:return true;
}
# allow login page to load

View file

@ -23,7 +23,9 @@
:global ParseKeyValueStore;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:if ([ :len $MacAddress ] = 0 || [ :len $UserName ] = 0) do={
$LogPrintExit2 error $ScriptName ("This script is supposed to run from hotspot on login.") true;
@ -52,7 +54,8 @@
comment=("hotspot-to-wpa template " . $Hotspot) disabled ]->0) ];
:if ($Template->"action" = "reject") do={
$LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") true;
$LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") false;
:return true;
}
# allow login page to load

View file

@ -25,7 +25,9 @@
:global LogPrintExit2;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:local Zone \
([ $IfThenElse ($PrefixInZone = true) "ipsec." ] . \

View file

@ -19,7 +19,9 @@
:global ParseKeyValueStore;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:if ([ :typeof $PdPrefix ] = "nothing") do={
$LogPrintExit2 error $ScriptName ("This script is supposed to run from ipv6 dhcp-client.") true;

View file

@ -34,10 +34,13 @@
$LogPrintExit2 debug $ScriptName ("DHCP Server " . $leaseServerName . " " . [ $IfThenElse ($leaseBound = 0) \
"de" "" ] . "assigned lease " . $leaseActIP . " to " . $leaseActMAC) false;
$ScriptLock $ScriptName false 10;
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
:return false;
}
:if ([ :len [ /system/script/job/find where script=$ScriptName ] ] > 1) do={
$LogPrintExit2 debug $ScriptName ("More invocations are waiting, exiting early.") true;
$LogPrintExit2 debug $ScriptName ("More invocations are waiting, exiting early.") false;
:return true;
}
:local RunOrder ({});

View file

@ -32,7 +32,9 @@
:global SendNotification2;
:global SymbolForNotification;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:if ([ :typeof $LogForwardRateLimit ] = "nothing") do={
:set LogForwardRateLimit 0;
@ -40,7 +42,8 @@
:if ($LogForwardRateLimit > 30) do={
:set LogForwardRateLimit ($LogForwardRateLimit - 1);
$LogPrintExit2 info $ScriptName ("Rate limit in action, not forwarding logs, if any!") true;
$LogPrintExit2 info $ScriptName ("Rate limit in action, not forwarding logs, if any!") false;
:return true;
}
:local Count 0;

View file

@ -20,11 +20,14 @@
:global ParseKeyValueStore;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:local SettleTime (5m30s - [ /system/resource/get uptime ]);
:if ($SettleTime > 0s) do={
$LogPrintExit2 info $ScriptName ("System just booted, giving netwatch " . $SettleTime . " to settle.") true;
$LogPrintExit2 info $ScriptName ("System just booted, giving netwatch " . $SettleTime . " to settle.") false;
:return true;
}
:local DnsServers ({});
@ -80,7 +83,8 @@
}
:if ($DohCurrent = $HostInfo->"doh-url") do={
$LogPrintExit2 debug $ScriptName ("Current DoH server is still up: " . $DohCurrent) true;
$LogPrintExit2 debug $ScriptName ("Current DoH server is still up: " . $DohCurrent) false;
:return true;
}
:set ($DohServers->[ :len $DohServers ]) $HostInfo;
@ -116,7 +120,8 @@
:if ([ :typeof [ :find $Data "doh-check-OK" ] ] = "num") do={
/ip/dns/set use-doh-server=($DohServer->"doh-url") verify-doh-cert=yes;
/ip/dns/cache/flush;
$LogPrintExit2 info $ScriptName ("Setting DoH server: " . ($DohServer->"doh-url")) true;
$LogPrintExit2 info $ScriptName ("Setting DoH server: " . ($DohServer->"doh-url")) false;
:return true;
} else={
$LogPrintExit2 warning $ScriptName ("Received unexpected response from DoH server: " . \
($DohServer->"doh-url")) false;

View file

@ -75,7 +75,9 @@
:return false;
}
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:local ScriptFromTerminalCached [ $ScriptFromTerminal $ScriptName ];

View file

@ -18,7 +18,9 @@
:global ParseKeyValueStore;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:foreach Instance in=[ /routing/ospf/instance/find where comment~"^ospf-to-leds," ] do={
:local InstanceVal [ /routing/ospf/instance/get $Instance ];

View file

@ -39,10 +39,13 @@
on-event=("/system/scheduler/remove \"_RebootForUpdate\"; " . \
":global RebootForUpdate; \$RebootForUpdate;");
$LogPrintExit2 info $ScriptName ("Scheduled reboot for update at " . $StartTime . \
" local time (" . [ /system/clock/get time-zone-name ] . ").") true;
" local time (" . [ /system/clock/get time-zone-name ] . ").") false;
:return true;
}
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:local Update [ /system/package/update/get ];
@ -51,7 +54,8 @@
}
:if ($Update->"installed-version" = $Update->"latest-version") do={
$LogPrintExit2 info $ScriptName ("Version " . $Update->"latest-version" . " is already installed.") true;
$LogPrintExit2 info $ScriptName ("Version " . $Update->"latest-version" . " is already installed.") false;
:return true;
}
:local NumInstalled [ $VersionToNum ($Update->"installed-version") ];

View file

@ -27,7 +27,9 @@
:global ValidateSyntax;
:global WaitFullyConnected;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:if ([ /tool/sms/get receive-enabled ] = false) do={
$LogPrintOnce warning $ScriptName ("Receiving of SMS is not enabled.") true;
@ -38,7 +40,8 @@
:local Settings [ /tool/sms/get ];
:if ([ /interface/lte/get ($Settings->"port") running ] != true) do={
$LogPrintExit2 info $ScriptName ("The LTE interface is not in running state, skipping.") true;
$LogPrintExit2 info $ScriptName ("The LTE interface is not in running state, skipping.") false;
:return true;
}
# forward SMS in a loop

View file

@ -43,7 +43,9 @@
:global WaitForFile;
:global WaitFullyConnected;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
$WaitFullyConnected;

View file

@ -19,7 +19,9 @@
:global LogPrintExit2;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
/interface/gre/set remote-address=0.0.0.0 disabled=yes [ find where !running !disabled ];

View file

@ -21,7 +21,9 @@
:global ParseKeyValueStore;
:global ScriptLock;
$ScriptLock $ScriptName;
:if ([ $ScriptLock $ScriptName ] = false) do={
:return false;
}
:if ([ $CertificateAvailable "Starfield Secure Certificate Authority - G2" ] = false) do={
$LogPrintExit2 error $ScriptName ("Downloading required certificate failed.") true;