aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-03-05 16:12:36 +0100
committerGravatar Christian Hesse <mail@eworm.de>2024-03-12 15:27:15 +0100
commit1e8918fdaa5a30393e2004d1f5e4dff458936b67 (patch)
tree9448ec9ff079f6f6c083f68fb4d8e53167bede51
parent56e97dd60c3c9603df07bb315587c44da1ff44fd (diff)
global-functions: $ScriptLock: do not exit from global function
-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.rsc4
-rw-r--r--check-lte-firmware-upgrade.rsc4
-rw-r--r--check-routeros-update.rsc4
-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.rsc4
-rw-r--r--fw-addr-lists.rsc4
-rw-r--r--global-functions.rsc9
-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.rsc4
-rw-r--r--hotspot-to-wpa.template.rsc4
-rw-r--r--hotspot-to-wpa.wifi.rsc4
-rw-r--r--hotspot-to-wpa.wifiwave2.rsc4
-rw-r--r--ipsec-to-dns.rsc4
-rw-r--r--ipv6-update.rsc4
-rw-r--r--lease-script.rsc4
-rw-r--r--log-forward.rsc4
-rw-r--r--netwatch-dns.rsc4
-rw-r--r--netwatch-notify.rsc4
-rw-r--r--ospf-to-leds.rsc4
-rw-r--r--packages-update.rsc4
-rw-r--r--sms-forward.rsc4
-rw-r--r--telegram-chat.rsc4
-rw-r--r--update-gre-address.rsc4
-rw-r--r--update-tunnelbroker.rsc4
57 files changed, 172 insertions, 61 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 9d7c68e..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 ];
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 1e3a1f4..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={
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 95adab0..bd28f12 100644
--- a/firmware-upgrade-reboot.rsc
+++ b/firmware-upgrade-reboot.rsc
@@ -18,7 +18,9 @@
: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={
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 b68fbaa..1e36616 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -1170,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;
@@ -1286,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" "" ] . "... Aborting.") 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 f9f9324..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;
diff --git a/hotspot-to-wpa.template.rsc b/hotspot-to-wpa.template.rsc
index 9fa52c5..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;
diff --git a/hotspot-to-wpa.wifi.rsc b/hotspot-to-wpa.wifi.rsc
index 7638cf7..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;
diff --git a/hotspot-to-wpa.wifiwave2.rsc b/hotspot-to-wpa.wifiwave2.rsc
index 1b60227..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;
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 64e7f46..582f8ff 100644
--- a/lease-script.rsc
+++ b/lease-script.rsc
@@ -34,7 +34,9 @@
$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.") false;
diff --git a/log-forward.rsc b/log-forward.rsc
index 5044d43..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;
diff --git a/netwatch-dns.rsc b/netwatch-dns.rsc
index 1603427..2468d35 100644
--- a/netwatch-dns.rsc
+++ b/netwatch-dns.rsc
@@ -20,7 +20,9 @@
:global ParseKeyValueStore;
:global ScriptLock;
- $ScriptLock $ScriptName;
+ :if ([ $ScriptLock $ScriptName ] = false) do={
+ :return false;
+ }
:local SettleTime (5m30s - [ /system/resource/get uptime ]);
:if ($SettleTime > 0s) do={
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 e6bed78..5b6d158 100644
--- a/packages-update.rsc
+++ b/packages-update.rsc
@@ -43,7 +43,9 @@
:return true;
}
- $ScriptLock $ScriptName;
+ :if ([ $ScriptLock $ScriptName ] = false) do={
+ :return false;
+ }
:local Update [ /system/package/update/get ];
diff --git a/sms-forward.rsc b/sms-forward.rsc
index f85dab2..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;
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;