aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-03-04 17:54:28 +0100
committerGravatar Christian Hesse <mail@eworm.de>2024-03-12 15:27:15 +0100
commitc462c0b5983811d8a8b66e08184b38440941ff1c (patch)
treed798b765641787f0220ea1340327118e0d57b229
parentd46156ad92322ffda1c7769d8eb9ea2b9fab6015 (diff)
parentada91536366d72e1a30c186be9289fb455ab3149 (diff)
Merge branch 'no-error-on-exit' into nextrouteros-7.15beta4-1
-rw-r--r--backup-cloud.rsc4
-rw-r--r--backup-email.rsc4
-rw-r--r--backup-partition.rsc4
-rw-r--r--backup-upload.rsc4
-rw-r--r--capsman-download-packages.capsman.rsc4
-rw-r--r--capsman-download-packages.template.rsc4
-rw-r--r--capsman-download-packages.wifi.rsc4
-rw-r--r--capsman-download-packages.wifiwave2.rsc4
-rw-r--r--capsman-rolling-upgrade.capsman.rsc4
-rw-r--r--capsman-rolling-upgrade.template.rsc4
-rw-r--r--capsman-rolling-upgrade.wifi.rsc4
-rw-r--r--capsman-rolling-upgrade.wifiwave2.rsc4
-rw-r--r--certificate-renew-issued.rsc4
-rw-r--r--check-certificates.rsc4
-rw-r--r--check-health.rsc7
-rw-r--r--check-lte-firmware-upgrade.rsc4
-rw-r--r--check-routeros-update.rsc13
-rw-r--r--collect-wireless-mac.capsman.rsc4
-rw-r--r--collect-wireless-mac.local.rsc4
-rw-r--r--collect-wireless-mac.template.rsc4
-rw-r--r--collect-wireless-mac.wifi.rsc4
-rw-r--r--collect-wireless-mac.wifiwave2.rsc4
-rw-r--r--daily-psk.capsman.rsc4
-rw-r--r--daily-psk.local.rsc4
-rw-r--r--daily-psk.template.rsc4
-rw-r--r--daily-psk.wifi.rsc4
-rw-r--r--daily-psk.wifiwave2.rsc4
-rw-r--r--dhcp-lease-comment.capsman.rsc4
-rw-r--r--dhcp-lease-comment.local.rsc4
-rw-r--r--dhcp-lease-comment.template.rsc4
-rw-r--r--dhcp-lease-comment.wifi.rsc4
-rw-r--r--dhcp-lease-comment.wifiwave2.rsc4
-rw-r--r--dhcp-to-dns.rsc4
-rw-r--r--firmware-upgrade-reboot.rsc10
-rw-r--r--fw-addr-lists.rsc4
-rw-r--r--global-functions.rsc12
-rw-r--r--gps-track.rsc4
-rw-r--r--hotspot-to-wpa-cleanup.capsman.rsc4
-rw-r--r--hotspot-to-wpa-cleanup.template.rsc4
-rw-r--r--hotspot-to-wpa-cleanup.wifi.rsc4
-rw-r--r--hotspot-to-wpa-cleanup.wifiwave2.rsc4
-rw-r--r--hotspot-to-wpa.capsman.rsc7
-rw-r--r--hotspot-to-wpa.template.rsc7
-rw-r--r--hotspot-to-wpa.wifi.rsc7
-rw-r--r--hotspot-to-wpa.wifiwave2.rsc7
-rw-r--r--ipsec-to-dns.rsc4
-rw-r--r--ipv6-update.rsc4
-rw-r--r--lease-script.rsc7
-rw-r--r--log-forward.rsc7
-rw-r--r--netwatch-dns.rsc13
-rw-r--r--netwatch-notify.rsc4
-rw-r--r--ospf-to-leds.rsc4
-rw-r--r--packages-update.rsc10
-rw-r--r--sms-forward.rsc7
-rw-r--r--telegram-chat.rsc4
-rw-r--r--update-gre-address.rsc4
-rw-r--r--update-tunnelbroker.rsc4
57 files changed, 210 insertions, 80 deletions
diff --git a/backup-cloud.rsc b/backup-cloud.rsc
index 94966c5..418e68d 100644
--- a/backup-cloud.rsc
+++ b/backup-cloud.rsc
@@ -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={
diff --git a/backup-email.rsc b/backup-email.rsc
index 7380a5d..c5b4568 100644
--- a/backup-email.rsc
+++ b/backup-email.rsc
@@ -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={
diff --git a/backup-partition.rsc b/backup-partition.rsc
index 4793f12..74dccfe 100644
--- a/backup-partition.rsc
+++ b/backup-partition.rsc
@@ -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;
diff --git a/backup-upload.rsc b/backup-upload.rsc
index dfba15e..c2b3285 100644
--- a/backup-upload.rsc
+++ b/backup-upload.rsc
@@ -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={
diff --git a/capsman-download-packages.capsman.rsc b/capsman-download-packages.capsman.rsc
index 18ecf57..cb82a37 100644
--- a/capsman-download-packages.capsman.rsc
+++ b/capsman-download-packages.capsman.rsc
@@ -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 ] ];
diff --git a/capsman-download-packages.template.rsc b/capsman-download-packages.template.rsc
index 8cc7b2d..41d2dca 100644
--- a/capsman-download-packages.template.rsc
+++ b/capsman-download-packages.template.rsc
@@ -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 ] ];
diff --git a/capsman-download-packages.wifi.rsc b/capsman-download-packages.wifi.rsc
index 6f62c54..89af381 100644
--- a/capsman-download-packages.wifi.rsc
+++ b/capsman-download-packages.wifi.rsc
@@ -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 ] ];
diff --git a/capsman-download-packages.wifiwave2.rsc b/capsman-download-packages.wifiwave2.rsc
index 705da70..2b8ea73 100644
--- a/capsman-download-packages.wifiwave2.rsc
+++ b/capsman-download-packages.wifiwave2.rsc
@@ -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 ] ];
diff --git a/capsman-rolling-upgrade.capsman.rsc b/capsman-rolling-upgrade.capsman.rsc
index fb0904d..9379b24 100644
--- a/capsman-rolling-upgrade.capsman.rsc
+++ b/capsman-rolling-upgrade.capsman.rsc
@@ -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 ];
diff --git a/capsman-rolling-upgrade.template.rsc b/capsman-rolling-upgrade.template.rsc
index 6ea9ac0..c810f43 100644
--- a/capsman-rolling-upgrade.template.rsc
+++ b/capsman-rolling-upgrade.template.rsc
@@ -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 ];
diff --git a/capsman-rolling-upgrade.wifi.rsc b/capsman-rolling-upgrade.wifi.rsc
index d788c29..205d1d8 100644
--- a/capsman-rolling-upgrade.wifi.rsc
+++ b/capsman-rolling-upgrade.wifi.rsc
@@ -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 ];
diff --git a/capsman-rolling-upgrade.wifiwave2.rsc b/capsman-rolling-upgrade.wifiwave2.rsc
index 78e348d..4b3aba4 100644
--- a/capsman-rolling-upgrade.wifiwave2.rsc
+++ b/capsman-rolling-upgrade.wifiwave2.rsc
@@ -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 ];
diff --git a/certificate-renew-issued.rsc b/certificate-renew-issued.rsc
index 79ed0ba..7bf4128 100644
--- a/certificate-renew-issued.rsc
+++ b/certificate-renew-issued.rsc
@@ -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 ];
diff --git a/check-certificates.rsc b/check-certificates.rsc
index f15f145..69d9097 100644
--- a/check-certificates.rsc
+++ b/check-certificates.rsc
@@ -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={
diff --git a/check-health.rsc b/check-health.rsc
index b819665..df76d25 100644
--- a/check-health.rsc
+++ b/check-health.rsc
@@ -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={
diff --git a/check-lte-firmware-upgrade.rsc b/check-lte-firmware-upgrade.rsc
index 12d2dd4..18109fb 100644
--- a/check-lte-firmware-upgrade.rsc
+++ b/check-lte-firmware-upgrade.rsc
@@ -18,7 +18,9 @@
:global ScriptLock;
- $ScriptLock $ScriptName;
+ :if ([ $ScriptLock $ScriptName ] = false) do={
+ :return false;
+ }
:if ([ :typeof $SentLteFirmwareUpgradeNotification ] != "array") do={
:global SentLteFirmwareUpgradeNotification ({});
diff --git a/check-routeros-update.rsc b/check-routeros-update.rsc
index 519c2d4..ae0038c 100644
--- a/check-routeros-update.rsc
+++ b/check-routeros-update.rsc
@@ -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; \
diff --git a/collect-wireless-mac.capsman.rsc b/collect-wireless-mac.capsman.rsc
index 0ae15ee..3a10b1f 100644
--- a/collect-wireless-mac.capsman.rsc
+++ b/collect-wireless-mac.capsman.rsc
@@ -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;
diff --git a/collect-wireless-mac.local.rsc b/collect-wireless-mac.local.rsc
index 0353ddb..f6f898e 100644
--- a/collect-wireless-mac.local.rsc
+++ b/collect-wireless-mac.local.rsc
@@ -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;
diff --git a/collect-wireless-mac.template.rsc b/collect-wireless-mac.template.rsc
index 71f5679..d046fbe 100644
--- a/collect-wireless-mac.template.rsc
+++ b/collect-wireless-mac.template.rsc
@@ -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={
diff --git a/collect-wireless-mac.wifi.rsc b/collect-wireless-mac.wifi.rsc
index f35cdad..c866bcc 100644
--- a/collect-wireless-mac.wifi.rsc
+++ b/collect-wireless-mac.wifi.rsc
@@ -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;
diff --git a/collect-wireless-mac.wifiwave2.rsc b/collect-wireless-mac.wifiwave2.rsc
index 86aef65..de8cdab 100644
--- a/collect-wireless-mac.wifiwave2.rsc
+++ b/collect-wireless-mac.wifiwave2.rsc
@@ -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;
diff --git a/daily-psk.capsman.rsc b/daily-psk.capsman.rsc
index b47ae14..85e05b6 100644
--- a/daily-psk.capsman.rsc
+++ b/daily-psk.capsman.rsc
@@ -30,7 +30,9 @@
:global WaitForFile;
:global WaitFullyConnected;
- $ScriptLock $ScriptName;
+ :if ([ $ScriptLock $ScriptName ] = false) do={
+ :return false;
+ }
$WaitFullyConnected;
# return pseudo-random string for PSK
diff --git a/daily-psk.local.rsc b/daily-psk.local.rsc
index 72e20ef..108c711 100644
--- a/daily-psk.local.rsc
+++ b/daily-psk.local.rsc
@@ -30,7 +30,9 @@
:global WaitForFile;
:global WaitFullyConnected;
- $ScriptLock $ScriptName;
+ :if ([ $ScriptLock $ScriptName ] = false) do={
+ :return false;
+ }
$WaitFullyConnected;
# return pseudo-random string for PSK
diff --git a/daily-psk.template.rsc b/daily-psk.template.rsc
index 2f2838e..93cefeb 100644
--- a/daily-psk.template.rsc
+++ b/daily-psk.template.rsc
@@ -31,7 +31,9 @@
:global WaitForFile;
:global WaitFullyConnected;
- $ScriptLock $ScriptName;
+ :if ([ $ScriptLock $ScriptName ] = false) do={
+ :return false;
+ }
$WaitFullyConnected;
# return pseudo-random string for PSK
diff --git a/daily-psk.wifi.rsc b/daily-psk.wifi.rsc
index e013dd1..0ba22ab 100644
--- a/daily-psk.wifi.rsc
+++ b/daily-psk.wifi.rsc
@@ -30,7 +30,9 @@
:global WaitForFile;
:global WaitFullyConnected;
- $ScriptLock $ScriptName;
+ :if ([ $ScriptLock $ScriptName ] = false) do={
+ :return false;
+ }
$WaitFullyConnected;
# return pseudo-random string for PSK
diff --git a/daily-psk.wifiwave2.rsc b/daily-psk.wifiwave2.rsc
index 75cfb7a..4e71489 100644
--- a/daily-psk.wifiwave2.rsc
+++ b/daily-psk.wifiwave2.rsc
@@ -30,7 +30,9 @@
:global WaitForFile;
:global WaitFullyConnected;
- $ScriptLock $ScriptName;
+ :if ([ $ScriptLock $ScriptName ] = false) do={
+ :return false;
+ }
$WaitFullyConnected;
# return pseudo-random string for PSK
diff --git a/dhcp-lease-comment.capsman.rsc b/dhcp-lease-comment.capsman.rsc
index 825077a..09893ce 100644
--- a/dhcp-lease-comment.capsman.rsc
+++ b/dhcp-lease-comment.capsman.rsc
@@ -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 ];
diff --git a/dhcp-lease-comment.local.rsc b/dhcp-lease-comment.local.rsc
index 13c04a7..a5e9330 100644
--- a/dhcp-lease-comment.local.rsc
+++ b/dhcp-lease-comment.local.rsc
@@ -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 ];
diff --git a/dhcp-lease-comment.template.rsc b/dhcp-lease-comment.template.rsc
index 9f79d06..d0133c8 100644
--- a/dhcp-lease-comment.template.rsc
+++ b/dhcp-lease-comment.template.rsc
@@ -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 ];
diff --git a/dhcp-lease-comment.wifi.rsc b/dhcp-lease-comment.wifi.rsc
index cba1d6c..2552b5a 100644
--- a/dhcp-lease-comment.wifi.rsc
+++ b/dhcp-lease-comment.wifi.rsc
@@ -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 ];
diff --git a/dhcp-lease-comment.wifiwave2.rsc b/dhcp-lease-comment.wifiwave2.rsc
index 137ac6d..7cc29da 100644
--- a/dhcp-lease-comment.wifiwave2.rsc
+++ b/dhcp-lease-comment.wifiwave2.rsc
@@ -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 ];
diff --git a/dhcp-to-dns.rsc b/dhcp-to-dns.rsc
index 1cdd86e..df6ae01 100644
--- a/dhcp-to-dns.rsc
+++ b/dhcp-to-dns.rsc
@@ -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);
diff --git a/firmware-upgrade-reboot.rsc b/firmware-upgrade-reboot.rsc
index efe22ae..bd28f12 100644
--- a/firmware-upgrade-reboot.rsc
+++ b/firmware-upgrade-reboot.rsc
@@ -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={
diff --git a/fw-addr-lists.rsc b/fw-addr-lists.rsc
index d4ac519..8ba0147 100644
--- a/fw-addr-lists.rsc
+++ b/fw-addr-lists.rsc
@@ -34,7 +34,9 @@
}
}
- $ScriptLock $ScriptName;
+ :if ([ $ScriptLock $ScriptName ] = false) do={
+ :return false;
+ }
$WaitFullyConnected;
:local ListComment ("managed by " . $ScriptName);
diff --git a/global-functions.rsc b/global-functions.rsc
index 90148f8..6ddcbd3 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -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
diff --git a/gps-track.rsc b/gps-track.rsc
index 8517778..cef95f2 100644
--- a/gps-track.rsc
+++ b/gps-track.rsc
@@ -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 ];
diff --git a/hotspot-to-wpa-cleanup.capsman.rsc b/hotspot-to-wpa-cleanup.capsman.rsc
index 498e853..62beacc 100644
--- a/hotspot-to-wpa-cleanup.capsman.rsc
+++ b/hotspot-to-wpa-cleanup.capsman.rsc
@@ -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={
diff --git a/hotspot-to-wpa-cleanup.template.rsc b/hotspot-to-wpa-cleanup.template.rsc
index 9ffc6ea..c393888 100644
--- a/hotspot-to-wpa-cleanup.template.rsc
+++ b/hotspot-to-wpa-cleanup.template.rsc
@@ -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={
diff --git a/hotspot-to-wpa-cleanup.wifi.rsc b/hotspot-to-wpa-cleanup.wifi.rsc
index cf7eaad..a44064f 100644
--- a/hotspot-to-wpa-cleanup.wifi.rsc
+++ b/hotspot-to-wpa-cleanup.wifi.rsc
@@ -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={
diff --git a/hotspot-to-wpa-cleanup.wifiwave2.rsc b/hotspot-to-wpa-cleanup.wifiwave2.rsc
index bbb64c5..e5a0cf5 100644
--- a/hotspot-to-wpa-cleanup.wifiwave2.rsc
+++ b/hotspot-to-wpa-cleanup.wifiwave2.rsc
@@ -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={
diff --git a/hotspot-to-wpa.capsman.rsc b/hotspot-to-wpa.capsman.rsc
index d903fe9..7498ae2 100644
--- a/hotspot-to-wpa.capsman.rsc
+++ b/hotspot-to-wpa.capsman.rsc
@@ -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
diff --git a/hotspot-to-wpa.template.rsc b/hotspot-to-wpa.template.rsc
index 1f82c28..9038d82 100644
--- a/hotspot-to-wpa.template.rsc
+++ b/hotspot-to-wpa.template.rsc
@@ -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
diff --git a/hotspot-to-wpa.wifi.rsc b/hotspot-to-wpa.wifi.rsc
index cd6aa80..83f490d 100644
--- a/hotspot-to-wpa.wifi.rsc
+++ b/hotspot-to-wpa.wifi.rsc
@@ -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
diff --git a/hotspot-to-wpa.wifiwave2.rsc b/hotspot-to-wpa.wifiwave2.rsc
index ef068b6..519f81f 100644
--- a/hotspot-to-wpa.wifiwave2.rsc
+++ b/hotspot-to-wpa.wifiwave2.rsc
@@ -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
diff --git a/ipsec-to-dns.rsc b/ipsec-to-dns.rsc
index ff445e6..e19a11b 100644
--- a/ipsec-to-dns.rsc
+++ b/ipsec-to-dns.rsc
@@ -25,7 +25,9 @@
:global LogPrintExit2;
:global ScriptLock;
- $ScriptLock $ScriptName;
+ :if ([ $ScriptLock $ScriptName ] = false) do={
+ :return false;
+ }
:local Zone \
([ $IfThenElse ($PrefixInZone = true) "ipsec." ] . \
diff --git a/ipv6-update.rsc b/ipv6-update.rsc
index 350fc4b..d173347 100644
--- a/ipv6-update.rsc
+++ b/ipv6-update.rsc
@@ -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;
diff --git a/lease-script.rsc b/lease-script.rsc
index d9c7177..582f8ff 100644
--- a/lease-script.rsc
+++ b/lease-script.rsc
@@ -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 ({});
diff --git a/log-forward.rsc b/log-forward.rsc
index 13b490e..b9dbc8b 100644
--- a/log-forward.rsc
+++ b/log-forward.rsc
@@ -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;
diff --git a/netwatch-dns.rsc b/netwatch-dns.rsc
index 45c12d4..2468d35 100644
--- a/netwatch-dns.rsc
+++ b/netwatch-dns.rsc
@@ -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;
diff --git a/netwatch-notify.rsc b/netwatch-notify.rsc
index 28ab229..ce74ffa 100644
--- a/netwatch-notify.rsc
+++ b/netwatch-notify.rsc
@@ -75,7 +75,9 @@
:return false;
}
- $ScriptLock $ScriptName;
+ :if ([ $ScriptLock $ScriptName ] = false) do={
+ :return false;
+ }
:local ScriptFromTerminalCached [ $ScriptFromTerminal $ScriptName ];
diff --git a/ospf-to-leds.rsc b/ospf-to-leds.rsc
index a462d2a..3ca16db 100644
--- a/ospf-to-leds.rsc
+++ b/ospf-to-leds.rsc
@@ -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 ];
diff --git a/packages-update.rsc b/packages-update.rsc
index 325009f..5b6d158 100644
--- a/packages-update.rsc
+++ b/packages-update.rsc
@@ -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") ];
diff --git a/sms-forward.rsc b/sms-forward.rsc
index fee1539..7c4488a 100644
--- a/sms-forward.rsc
+++ b/sms-forward.rsc
@@ -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
diff --git a/telegram-chat.rsc b/telegram-chat.rsc
index 197c8a3..bb12042 100644
--- a/telegram-chat.rsc
+++ b/telegram-chat.rsc
@@ -43,7 +43,9 @@
:global WaitForFile;
:global WaitFullyConnected;
- $ScriptLock $ScriptName;
+ :if ([ $ScriptLock $ScriptName ] = false) do={
+ :return false;
+ }
$WaitFullyConnected;
diff --git a/update-gre-address.rsc b/update-gre-address.rsc
index 62cdfe1..d9a7a55 100644
--- a/update-gre-address.rsc
+++ b/update-gre-address.rsc
@@ -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 ];
diff --git a/update-tunnelbroker.rsc b/update-tunnelbroker.rsc
index c61d82e..90e3f24 100644
--- a/update-tunnelbroker.rsc
+++ b/update-tunnelbroker.rsc
@@ -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;