From 7fa03ab70e4e711dfb3ceeefa37639bf6676e27c Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 4 Mar 2024 15:27:03 +0100 Subject: log-forward: do not exit with error --- log-forward.rsc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/log-forward.rsc b/log-forward.rsc index 13b490e..5044d43 100644 --- a/log-forward.rsc +++ b/log-forward.rsc @@ -40,7 +40,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; -- cgit v1.2.3-70-g09d2 From 6712cc101d57fbe47420c562ea82d36b07a5ad9c Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 4 Mar 2024 15:27:57 +0100 Subject: check-health: do not exit with error --- check-health.rsc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/check-health.rsc b/check-health.rsc index b819665..9d7c68e 100644 --- a/check-health.rsc +++ b/check-health.rsc @@ -75,7 +75,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={ -- cgit v1.2.3-70-g09d2 From 5af8b95444ae161bcc38565163aa4ed56a8e3f0e Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 4 Mar 2024 15:29:33 +0100 Subject: netwatch-dns: do not exit with error --- netwatch-dns.rsc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/netwatch-dns.rsc b/netwatch-dns.rsc index 45c12d4..1603427 100644 --- a/netwatch-dns.rsc +++ b/netwatch-dns.rsc @@ -24,7 +24,8 @@ :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 +81,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 +118,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; -- cgit v1.2.3-70-g09d2 From 184a769eebc245be7b60f0c6e8ee4157b740c704 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 4 Mar 2024 15:45:09 +0100 Subject: check-routeros-update: do not exit with error --- check-routeros-update.rsc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/check-routeros-update.rsc b/check-routeros-update.rsc index 519c2d4..1e3a1f4 100644 --- a/check-routeros-update.rsc +++ b/check-routeros-update.rsc @@ -53,7 +53,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 +130,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 +145,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; \ -- cgit v1.2.3-70-g09d2 From ab0b2e27c3d190b627325827d0fba5808cba9137 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 4 Mar 2024 15:46:46 +0100 Subject: firmware-upgrade-reboot: do not exit with error --- firmware-upgrade-reboot.rsc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/firmware-upgrade-reboot.rsc b/firmware-upgrade-reboot.rsc index efe22ae..95adab0 100644 --- a/firmware-upgrade-reboot.rsc +++ b/firmware-upgrade-reboot.rsc @@ -23,10 +23,12 @@ :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={ -- cgit v1.2.3-70-g09d2 From 3acdebad044785371208246ab74b062a32a6d09f Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 4 Mar 2024 15:58:32 +0100 Subject: hotspot-to-wpa: do not exit with error --- hotspot-to-wpa.capsman.rsc | 3 ++- hotspot-to-wpa.template.rsc | 3 ++- hotspot-to-wpa.wifi.rsc | 3 ++- hotspot-to-wpa.wifiwave2.rsc | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hotspot-to-wpa.capsman.rsc b/hotspot-to-wpa.capsman.rsc index d903fe9..f9f9324 100644 --- a/hotspot-to-wpa.capsman.rsc +++ b/hotspot-to-wpa.capsman.rsc @@ -52,7 +52,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..9fa52c5 100644 --- a/hotspot-to-wpa.template.rsc +++ b/hotspot-to-wpa.template.rsc @@ -65,7 +65,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..7638cf7 100644 --- a/hotspot-to-wpa.wifi.rsc +++ b/hotspot-to-wpa.wifi.rsc @@ -52,7 +52,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..1b60227 100644 --- a/hotspot-to-wpa.wifiwave2.rsc +++ b/hotspot-to-wpa.wifiwave2.rsc @@ -52,7 +52,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 -- cgit v1.2.3-70-g09d2 From c6639518bcd6689286ed63505d243369c95196e2 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 4 Mar 2024 16:01:00 +0100 Subject: lease-script: do not exit with error --- lease-script.rsc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lease-script.rsc b/lease-script.rsc index d9c7177..64e7f46 100644 --- a/lease-script.rsc +++ b/lease-script.rsc @@ -37,7 +37,8 @@ $ScriptLock $ScriptName false 10; :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 ({}); -- cgit v1.2.3-70-g09d2 From ec90695e8ff892926e9839d29bdbf672d2b5ca90 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 4 Mar 2024 16:18:29 +0100 Subject: packages-update: do not exit with error --- packages-update.rsc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages-update.rsc b/packages-update.rsc index 325009f..e6bed78 100644 --- a/packages-update.rsc +++ b/packages-update.rsc @@ -39,7 +39,8 @@ 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; @@ -51,7 +52,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") ]; -- cgit v1.2.3-70-g09d2 From 4004d713aa9c9ffeb5c317a5030e0e929d668460 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 4 Mar 2024 16:22:17 +0100 Subject: sms-forward: do not exit with error --- sms-forward.rsc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sms-forward.rsc b/sms-forward.rsc index fee1539..f85dab2 100644 --- a/sms-forward.rsc +++ b/sms-forward.rsc @@ -38,7 +38,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 -- cgit v1.2.3-70-g09d2 From 56e97dd60c3c9603df07bb315587c44da1ff44fd Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 5 Mar 2024 15:59:22 +0100 Subject: global-functions: $DownloadPackage: do not exit from global function --- global-functions.rsc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/global-functions.rsc b/global-functions.rsc index 90148f8..b68fbaa 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); -- cgit v1.2.3-70-g09d2 From 1e8918fdaa5a30393e2004d1f5e4dff458936b67 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 5 Mar 2024 16:12:36 +0100 Subject: global-functions: $ScriptLock: do not exit from global function --- backup-cloud.rsc | 4 +++- backup-email.rsc | 4 +++- backup-partition.rsc | 4 +++- backup-upload.rsc | 4 +++- capsman-download-packages.capsman.rsc | 4 +++- capsman-download-packages.template.rsc | 4 +++- capsman-download-packages.wifi.rsc | 4 +++- capsman-download-packages.wifiwave2.rsc | 4 +++- capsman-rolling-upgrade.capsman.rsc | 4 +++- capsman-rolling-upgrade.template.rsc | 4 +++- capsman-rolling-upgrade.wifi.rsc | 4 +++- capsman-rolling-upgrade.wifiwave2.rsc | 4 +++- certificate-renew-issued.rsc | 4 +++- check-certificates.rsc | 4 +++- check-health.rsc | 4 +++- check-lte-firmware-upgrade.rsc | 4 +++- check-routeros-update.rsc | 4 +++- collect-wireless-mac.capsman.rsc | 4 +++- collect-wireless-mac.local.rsc | 4 +++- collect-wireless-mac.template.rsc | 4 +++- collect-wireless-mac.wifi.rsc | 4 +++- collect-wireless-mac.wifiwave2.rsc | 4 +++- daily-psk.capsman.rsc | 4 +++- daily-psk.local.rsc | 4 +++- daily-psk.template.rsc | 4 +++- daily-psk.wifi.rsc | 4 +++- daily-psk.wifiwave2.rsc | 4 +++- dhcp-lease-comment.capsman.rsc | 4 +++- dhcp-lease-comment.local.rsc | 4 +++- dhcp-lease-comment.template.rsc | 4 +++- dhcp-lease-comment.wifi.rsc | 4 +++- dhcp-lease-comment.wifiwave2.rsc | 4 +++- dhcp-to-dns.rsc | 4 +++- firmware-upgrade-reboot.rsc | 4 +++- fw-addr-lists.rsc | 4 +++- global-functions.rsc | 9 ++++----- gps-track.rsc | 4 +++- hotspot-to-wpa-cleanup.capsman.rsc | 4 +++- hotspot-to-wpa-cleanup.template.rsc | 4 +++- hotspot-to-wpa-cleanup.wifi.rsc | 4 +++- hotspot-to-wpa-cleanup.wifiwave2.rsc | 4 +++- hotspot-to-wpa.capsman.rsc | 4 +++- hotspot-to-wpa.template.rsc | 4 +++- hotspot-to-wpa.wifi.rsc | 4 +++- hotspot-to-wpa.wifiwave2.rsc | 4 +++- ipsec-to-dns.rsc | 4 +++- ipv6-update.rsc | 4 +++- lease-script.rsc | 4 +++- log-forward.rsc | 4 +++- netwatch-dns.rsc | 4 +++- netwatch-notify.rsc | 4 +++- ospf-to-leds.rsc | 4 +++- packages-update.rsc | 4 +++- sms-forward.rsc | 4 +++- telegram-chat.rsc | 4 +++- update-gre-address.rsc | 4 +++- update-tunnelbroker.rsc | 4 +++- 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; -- cgit v1.2.3-70-g09d2 From ada91536366d72e1a30c186be9289fb455ab3149 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 5 Mar 2024 21:48:21 +0100 Subject: global-functions: $ScriptLock: fix wording... ... as this does (no longer) abort. --- global-functions.rsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global-functions.rsc b/global-functions.rsc index 1e36616..6ddcbd3 100644 --- a/global-functions.rsc +++ b/global-functions.rsc @@ -1290,7 +1290,7 @@ $RemoveTicket $Script $MyTicket; $LogPrintExit2 info $0 ("Script '" . $Script . "' started more than once" . [ $IfThenElse ($WaitCount > 0) \ - " and timed out waiting for lock" "" ] . "... Aborting.") false; + " and timed out waiting for lock" "" ] . "...") false; :return false; } -- cgit v1.2.3-70-g09d2