From d5afc79eed2a54ab005f1b0ccf656c43a57e0a9b Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 18 Feb 2021 14:52:47 +0100 Subject: global: drop script 'global-wait' All scripts wait for the global functions on their own now. --- README.md | 1 - accesslist-duplicates.capsman | 3 +++ accesslist-duplicates.local | 3 +++ accesslist-duplicates.template | 3 +++ bridge-port-to-default | 3 +++ bridge-port-toggle | 3 +++ capsman-download-packages | 3 +++ capsman-rolling-upgrade | 3 +++ certificate-renew-issued | 3 +++ check-certificates | 3 +++ check-health | 3 +++ check-lte-firmware-upgrade | 3 +++ check-routeros-update | 3 +++ cloud-backup | 3 +++ collect-wireless-mac.capsman | 3 +++ collect-wireless-mac.local | 3 +++ collect-wireless-mac.template | 3 +++ daily-psk.capsman | 3 +++ daily-psk.local | 3 +++ daily-psk.template | 3 +++ dhcp-lease-comment.capsman | 3 +++ dhcp-lease-comment.local | 3 +++ dhcp-lease-comment.template | 3 +++ dhcp-to-dns | 3 +++ doc/bridge-port.md | 11 ++--------- doc/capsman-download-packages.md | 7 ++----- doc/check-certificates.md | 2 +- doc/daily-psk.md | 13 ++++--------- doc/global-wait.md | 40 ---------------------------------------- email-backup | 3 +++ global-config | 2 +- global-config-overlay | 2 +- global-config.changes | 1 + global-functions | 9 +-------- global-wait | 10 ++++------ gps-track | 3 +++ hotspot-to-wpa | 3 +++ ipv6-update | 3 +++ lease-script | 3 +++ log-forward | 3 +++ mode-button | 3 +++ netwatch-notify | 3 +++ ospf-to-leds | 3 +++ packages-update | 3 +++ ppp-on-up | 3 +++ rotate-ntp | 3 +++ sms-action | 3 +++ sms-forward | 3 +++ update-gre-address | 3 +++ update-tunnelbroker | 3 +++ upload-backup | 3 +++ 51 files changed, 137 insertions(+), 81 deletions(-) delete mode 100644 doc/global-wait.md diff --git a/README.md b/README.md index c10a660..616f4e9 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,6 @@ Available Scripts * [Comment DHCP leases with info from access list](doc/dhcp-lease-comment.md) * [Create DNS records for DHCP leases](doc/dhcp-to-dns.md) * [Send backup via e-mail](doc/email-backup.md) -* [Wait for configuration und functions](doc/global-wait.md) * [Send GPS position to server](doc/gps-track.md) * [Use WPA2 network with hotspot credentials](doc/hotspot-to-wpa.md) * [Update configuration on IPv6 prefix change](doc/ipv6-update.md) diff --git a/accesslist-duplicates.capsman b/accesslist-duplicates.capsman index 4911760..54271c3 100644 --- a/accesslist-duplicates.capsman +++ b/accesslist-duplicates.capsman @@ -8,6 +8,9 @@ # # !! Do not edit this file, it is generated from template! +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :local Seen [ :toarray "" ]; :local Shown [ :toarray "" ]; diff --git a/accesslist-duplicates.local b/accesslist-duplicates.local index 84fafb3..3f783a4 100644 --- a/accesslist-duplicates.local +++ b/accesslist-duplicates.local @@ -8,6 +8,9 @@ # # !! Do not edit this file, it is generated from template! +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :local Seen [ :toarray "" ]; :local Shown [ :toarray "" ]; diff --git a/accesslist-duplicates.template b/accesslist-duplicates.template index 7161992..c14b630 100644 --- a/accesslist-duplicates.template +++ b/accesslist-duplicates.template @@ -9,6 +9,9 @@ # !! This is just a template! Replace '%PATH%' with 'caps-man' # !! or 'interface wireless'! +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :local Seen [ :toarray "" ]; :local Shown [ :toarray "" ]; diff --git a/bridge-port-to-default b/bridge-port-to-default index 286fb45..60e3112 100644 --- a/bridge-port-to-default +++ b/bridge-port-to-default @@ -6,6 +6,9 @@ # reset bridge ports to default bridge # https://git.eworm.de/cgit/routeros-scripts/about/doc/bridge-port.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global BridgePortTo; :global IfThenElse; diff --git a/bridge-port-toggle b/bridge-port-toggle index 78a64f7..9ad38cb 100644 --- a/bridge-port-toggle +++ b/bridge-port-toggle @@ -6,6 +6,9 @@ # toggle bridge ports between default and alt bridge # https://git.eworm.de/cgit/routeros-scripts/about/doc/bridge-port.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global BridgePortTo; :if ($BridgePortTo != "default") do={ diff --git a/capsman-download-packages b/capsman-download-packages index b6bff3a..13537fa 100644 --- a/capsman-download-packages +++ b/capsman-download-packages @@ -7,6 +7,9 @@ # download and cleanup packages for CAP installation from CAPsMAN # https://git.eworm.de/cgit/routeros-scripts/about/doc/capsman-download-packages.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global CleanFilePath; :global DownloadPackage; :global LogPrintExit; diff --git a/capsman-rolling-upgrade b/capsman-rolling-upgrade index 1f091b8..a765fb5 100644 --- a/capsman-rolling-upgrade +++ b/capsman-rolling-upgrade @@ -7,6 +7,9 @@ # upgrade CAPs one after another # https://git.eworm.de/cgit/routeros-scripts/about/doc/capsman-rolling-upgrade.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global LogPrintExit; :global ScriptLock; diff --git a/certificate-renew-issued b/certificate-renew-issued index 2eeaba0..2345f30 100644 --- a/certificate-renew-issued +++ b/certificate-renew-issued @@ -6,6 +6,9 @@ # renew locally issued certificates # https://git.eworm.de/cgit/routeros-scripts/about/doc/certificate-renew-issued.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global CertIssuedExportPass; :global LogPrintExit; diff --git a/check-certificates b/check-certificates index 39b7e2c..94ccc99 100644 --- a/check-certificates +++ b/check-certificates @@ -6,6 +6,9 @@ # check for certificate validity # https://git.eworm.de/cgit/routeros-scripts/about/doc/check-certificates.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global CertRenewPass; :global CertRenewTime; :global CertRenewUrl; diff --git a/check-health b/check-health index 7fa45cb..8cb2cf3 100644 --- a/check-health +++ b/check-health @@ -6,6 +6,9 @@ # check for RouterOS health state # https://git.eworm.de/cgit/routeros-scripts/about/doc/check-health.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global CheckHealthLast; :global CheckHealthTemperature; :global CheckHealthTemperatureDeviation; diff --git a/check-lte-firmware-upgrade b/check-lte-firmware-upgrade index a678fb6..ed3cb98 100644 --- a/check-lte-firmware-upgrade +++ b/check-lte-firmware-upgrade @@ -6,6 +6,9 @@ # check for LTE firmware upgrade, send notification # https://git.eworm.de/cgit/routeros-scripts/about/doc/check-lte-firmware-upgrade.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global Identity; :global SentLteFirmwareUpgradeNotification; diff --git a/check-routeros-update b/check-routeros-update index 412d84a..09127d3 100644 --- a/check-routeros-update +++ b/check-routeros-update @@ -6,6 +6,9 @@ # check for RouterOS update, send notification and/or install # https://git.eworm.de/cgit/routeros-scripts/about/doc/check-routeros-update.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global Identity; :global SafeUpdateNeighbor; :global SafeUpdatePatch; diff --git a/cloud-backup b/cloud-backup index f92ee50..e4e527b 100644 --- a/cloud-backup +++ b/cloud-backup @@ -6,6 +6,9 @@ # upload backup to MikroTik cloud # https://git.eworm.de/cgit/routeros-scripts/about/doc/cloud-backup.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global BackupPassword; :global Identity; diff --git a/collect-wireless-mac.capsman b/collect-wireless-mac.capsman index fda401e..bf8e691 100644 --- a/collect-wireless-mac.capsman +++ b/collect-wireless-mac.capsman @@ -8,6 +8,9 @@ # # !! Do not edit this file, it is generated from template! +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global Identity; :global GetMacVendor; diff --git a/collect-wireless-mac.local b/collect-wireless-mac.local index f9c135c..15c0c9a 100644 --- a/collect-wireless-mac.local +++ b/collect-wireless-mac.local @@ -8,6 +8,9 @@ # # !! Do not edit this file, it is generated from template! +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global Identity; :global GetMacVendor; diff --git a/collect-wireless-mac.template b/collect-wireless-mac.template index 1d031fe..2198136 100644 --- a/collect-wireless-mac.template +++ b/collect-wireless-mac.template @@ -9,6 +9,9 @@ # !! This is just a template! Replace '%PATH%' with 'caps-man' # !! or 'interface wireless'! +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global Identity; :global GetMacVendor; diff --git a/daily-psk.capsman b/daily-psk.capsman index 10b3403..b66b750 100644 --- a/daily-psk.capsman +++ b/daily-psk.capsman @@ -9,6 +9,9 @@ # # !! Do not edit this file, it is generated from template! +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global DailyPskMatchComment; :global Identity; diff --git a/daily-psk.local b/daily-psk.local index ec03c1a..e7f908f 100644 --- a/daily-psk.local +++ b/daily-psk.local @@ -9,6 +9,9 @@ # # !! Do not edit this file, it is generated from template! +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global DailyPskMatchComment; :global Identity; diff --git a/daily-psk.template b/daily-psk.template index 590b1ea..8cf08e0 100644 --- a/daily-psk.template +++ b/daily-psk.template @@ -10,6 +10,9 @@ # !! This is just a template! Replace '%PATH%' with 'caps-man' # !! or 'interface wireless'! +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global DailyPskMatchComment; :global Identity; diff --git a/dhcp-lease-comment.capsman b/dhcp-lease-comment.capsman index b663a0a..3c0b9e9 100644 --- a/dhcp-lease-comment.capsman +++ b/dhcp-lease-comment.capsman @@ -8,6 +8,9 @@ # # !! Do not edit this file, it is generated from template! +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global LogPrintExit; :foreach Lease in=[ / ip dhcp-server lease find where dynamic=yes status=bound ] do={ diff --git a/dhcp-lease-comment.local b/dhcp-lease-comment.local index 1d9eb08..dc2f708 100644 --- a/dhcp-lease-comment.local +++ b/dhcp-lease-comment.local @@ -8,6 +8,9 @@ # # !! Do not edit this file, it is generated from template! +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global LogPrintExit; :foreach Lease in=[ / ip dhcp-server lease find where dynamic=yes status=bound ] do={ diff --git a/dhcp-lease-comment.template b/dhcp-lease-comment.template index 4007765..e3ca6d0 100644 --- a/dhcp-lease-comment.template +++ b/dhcp-lease-comment.template @@ -9,6 +9,9 @@ # !! This is just a template! Replace '%PATH%' with 'caps-man' # !! or 'interface wireless'! +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global LogPrintExit; :foreach Lease in=[ / ip dhcp-server lease find where dynamic=yes status=bound ] do={ diff --git a/dhcp-to-dns b/dhcp-to-dns index 375e083..30ca63c 100644 --- a/dhcp-to-dns +++ b/dhcp-to-dns @@ -6,6 +6,9 @@ # check DHCP leases and add/remove/update DNS entries # https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-to-dns.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global Domain; :global HostNameInZone; :global Identity; diff --git a/doc/bridge-port.md b/doc/bridge-port.md index 167fa87..8cbe15b 100644 --- a/doc/bridge-port.md +++ b/doc/bridge-port.md @@ -33,11 +33,9 @@ There is also global configuration: * `BridgePortTo`: specify the configuration to be applied by default -Install [global-wait](global-wait.md) and add a scheduler to start with -default setup on system startup: +Add a scheduler to start with default setup on system startup: - $ScriptInstallUpdate global-wait; - / system scheduler add name=bridge-port-to-default on-event="/ system script { run global-wait; run bridge-port-to-default; }" start-time=startup; + / system scheduler add name=bridge-port-to-default on-event="/ system script run bridge-port-to-default;" start-time=startup; Usage and invocation -------------------- @@ -75,11 +73,6 @@ More configuration can be loaded by setting `BridgePortTo`: * Interfaces `en1` and `en2` are unchanged. * Interface `en3` is put in bridge `br-intern`. -See also --------- - -* [Wait for configuration und functions](global-wait.md) - --- [◀ Go back to main README](../README.md) [▲ Go back to top](#top) diff --git a/doc/capsman-download-packages.md b/doc/capsman-download-packages.md index 5acf914..8516ff4 100644 --- a/doc/capsman-download-packages.md +++ b/doc/capsman-download-packages.md @@ -19,11 +19,9 @@ Just install the script on CAPsMAN device: $ScriptInstallUpdate capsman-download-packages; -Optionally install [global-wait](global-wait.md) and add a scheduler to run -after startup: +Optionally add a scheduler to run after startup: - $ScriptInstallUpdate global-wait; - / system scheduler add name=capsman-download-packages on-event="/ system script { run global-wait; run capsman-download-packages; }" start-time=startup; + / system scheduler add name=capsman-download-packages on-event="/ system script run capsman-download-packages;" start-time=startup; Only packages available in older version are downloaded. For initial setup place the required packages to CAPsMAN package path (see @@ -55,7 +53,6 @@ See also -------- * [Run rolling CAP upgrades from CAPsMAN](capsman-rolling-upgrade.md) -* [Wait for configuration und functions](global-wait.md) --- [◀ Go back to main README](../README.md) diff --git a/doc/check-certificates.md b/doc/check-certificates.md index 6e4a851..318805d 100644 --- a/doc/check-certificates.md +++ b/doc/check-certificates.md @@ -44,7 +44,7 @@ Just run the script: Alternatively running on startup may be desired: - / system scheduler add name=check-certificates-startup on-event="/ system script { run global-wait; run check-certificates; }" start-time=startup; + / system scheduler add name=check-certificates-startup on-event="/ system script run check-certificates;" start-time=startup; See also -------- diff --git a/doc/daily-psk.md b/doc/daily-psk.md index c6055d6..d472269 100644 --- a/doc/daily-psk.md +++ b/doc/daily-psk.md @@ -12,23 +12,23 @@ passphrase to a pseudo-random string daily. Requirements and installation ----------------------------- -Just install this script and [global-wait](global-wait.md). +Just install this script. Depending on whether you use CAPsMAN (`/ caps-man`) or local wireless interface (`/ interface wireless`) you need to install a different script. For CAPsMAN: - $ScriptInstallUpdate daily-psk.capsman,global-wait; + $ScriptInstallUpdate daily-psk.capsman; For local interface: - $ScriptInstallUpdate daily-psk.local,global-wait; + $ScriptInstallUpdate daily-psk.local; And add schedulers to run the script: / system scheduler add interval=1d name=daily-psk-nightly on-event="/ system script run daily-psk.local;" start-date=may/23/2018 start-time=03:00:00; - / system scheduler add name=daily-psk-startup on-event="/ system script { run global-wait; run daily-psk.local; }" start-time=startup; + / system scheduler add name=daily-psk-startup on-event="/ system script run daily-psk.local;" start-time=startup; These will update the passphrase on boot and nightly at 3:00. @@ -46,11 +46,6 @@ Then add an access list entry: Also notification settings are required for e-mail and telegram. -See also --------- - -* [Wait for configuration und functions](global-wait.md) - --- [◀ Go back to main README](../README.md) [▲ Go back to top](#top) diff --git a/doc/global-wait.md b/doc/global-wait.md deleted file mode 100644 index bdceddf..0000000 --- a/doc/global-wait.md +++ /dev/null @@ -1,40 +0,0 @@ -Wait for configuration und functions -==================================== - -[◀ Go back to main README](../README.md) - -Description ------------ - -The global scripts `global-config`, `global-config-overlay` and -`global-functions` are run by scheduler at system startup. Running another -script at system startup may result in race condition where configuration -and/or function are not yet available. This script is supposed to wait -for everything being prepared. - -Do **not** add this script `global-wait` to the `global-scripts` scheduler! -It would inhibit the initialization of configuration and functions. - -Requirements and installation ------------------------------ - -Just install the script: - - $ScriptInstallUpdate global-wait; - -... and add it to your scheduler, for example in combination with -[bridge-port](bridge-port.md): - - / system scheduler add name=bridge-port-to-default on-event="/ system script { run global-wait; run bridge-port-to-default; }" start-time=startup; - -See also --------- - -* [Manage ports in bridge](bridge-port.md) -* [Download packages for CAP upgrade from CAPsMAN](capsman-download-packages.md) -* [Renew certificates and notify on expiration](check-certificates.md) -* [Use wireless network with daily psk](daily-psk.md) - ---- -[◀ Go back to main README](../README.md) -[▲ Go back to top](#top) diff --git a/email-backup b/email-backup index a60b701..7cd8222 100644 --- a/email-backup +++ b/email-backup @@ -6,6 +6,9 @@ # create and email backup and config file # https://git.eworm.de/cgit/routeros-scripts/about/doc/email-backup.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global BackupPassword; :global BackupSendBinary; :global BackupSendExport; diff --git a/global-config b/global-config index 4b20fbe..bf8ff8a 100644 --- a/global-config +++ b/global-config @@ -8,7 +8,7 @@ # Make sure all configuration properties are up to date and this # value is in sync with value in script 'global-functions'! -:global GlobalConfigVersion 43; +:global GlobalConfigVersion 44; # This is used for DNS and backup file. :global Domain "example.com"; diff --git a/global-config-overlay b/global-config-overlay index e8d7913..3e374b1 100644 --- a/global-config-overlay +++ b/global-config-overlay @@ -9,7 +9,7 @@ # Make sure all configuration properties are up to date and this # value is in sync with value in script 'global-functions'! # Comment or remove to disable change notifications. -:global GlobalConfigVersion 43; +:global GlobalConfigVersion 44; # Copy configuration from global-config here and modify it. diff --git a/global-config.changes b/global-config.changes index a27b43a..dcafb7c 100644 --- a/global-config.changes +++ b/global-config.changes @@ -47,6 +47,7 @@ 41="Implemented migration mechanism for script updates."; 42="Made severity in terminal output colorful, with opt-out."; 43="Added queue for e-mail notifications to resend later on error."; + 44="Dropped script 'global-wait', all scripts wait on their own now."; }; # Migration steps to be applied on script updates diff --git a/global-functions b/global-functions index bf09ad2..072164d 100644 --- a/global-functions +++ b/global-functions @@ -8,7 +8,7 @@ # https://git.eworm.de/cgit/routeros-scripts/about/ # expected configuration version -:global ExpectedConfigVersion 43; +:global ExpectedConfigVersion 44; # global variables not to be changed by user :global GlobalFunctionsReady false; @@ -624,13 +624,6 @@ $LogPrintExit warning ("Policies differ for script " . $ScriptVal->"name" . \ " and its scheduler " . $SchedulerVal->"name" . "!") false; } - :if ($SchedulerVal->"name" != "global-scripts" && \ - $SchedulerVal->"start-time" = "startup" && \ - $SchedulerVal->"interval" = 0s && \ - !(($SchedulerVal->"on-event") ~ "\\brun global-wait\\b")) do={ - $LogPrintExit warning ("Scheduler " . $SchedulerVal->"name" . " starts on startup, " . \ - "without waiting for global-functions. Run 'global-wait' to avoid race conditions!") false; - } } :if ([ :len $SourceNew ] = 0 && $ScriptUpdatesFetch = true) do={ diff --git a/global-wait b/global-wait index edb156b..18f2fb8 100644 --- a/global-wait +++ b/global-wait @@ -1,13 +1,11 @@ #!rsc by RouterOS # RouterOS script: global-wait -# Copyright (c) 2020-2021 Christian Hesse -# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md -# -# wait for global-functions to finish -# https://git.eworm.de/cgit/routeros-scripts/about/doc/global-wait.md :global GlobalFunctionsReady; - :while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + +:global LogPrintExit; + +$LogPrintExit warning ("This script 'global-wait' is now useless, please remove it from configuration.") true; diff --git a/gps-track b/gps-track index 1f7d228..5fbe240 100644 --- a/gps-track +++ b/gps-track @@ -6,6 +6,9 @@ # track gps data by sending json data to http server # https://git.eworm.de/cgit/routeros-scripts/about/doc/gps-track.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global GpsTrackUrl; :global Identity; diff --git a/hotspot-to-wpa b/hotspot-to-wpa index ca11775..09283cf 100644 --- a/hotspot-to-wpa +++ b/hotspot-to-wpa @@ -6,6 +6,9 @@ # add private WPA passphrase after hotspot login # https://git.eworm.de/cgit/routeros-scripts/about/doc/hotspot-to-wpa.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global LogPrintExit; :local MacAddress $"mac-address"; diff --git a/ipv6-update b/ipv6-update index d5b15c4..4f0812c 100644 --- a/ipv6-update +++ b/ipv6-update @@ -6,6 +6,9 @@ # update firewall and dns settings on IPv6 prefix change # https://git.eworm.de/cgit/routeros-scripts/about/doc/ipv6-update.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :local PdPrefix $"pd-prefix"; :global LogPrintExit; diff --git a/lease-script b/lease-script index 438df0f..a39a874 100644 --- a/lease-script +++ b/lease-script @@ -6,6 +6,9 @@ # run scripts on DHCP lease # https://git.eworm.de/cgit/routeros-scripts/about/doc/lease-script.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global LogPrintExit; :if ([ :typeof $leaseActIP ] = "nothing" || \ diff --git a/log-forward b/log-forward index ae9a352..c4458b2 100644 --- a/log-forward +++ b/log-forward @@ -6,6 +6,9 @@ # forward log messages via notification # https://git.eworm.de/cgit/routeros-scripts/about/doc/log-forward.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global Identity; :global LogForwardFilter; :global LogForwardFilterMessage; diff --git a/mode-button b/mode-button index 35c0899..cd94919 100644 --- a/mode-button +++ b/mode-button @@ -6,6 +6,9 @@ # act on multiple mode and reset button presses # https://git.eworm.de/cgit/routeros-scripts/about/doc/mode-button.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global ModeButton; :global LogPrintExit; diff --git a/netwatch-notify b/netwatch-notify index 9651841..d050b75 100644 --- a/netwatch-notify +++ b/netwatch-notify @@ -6,6 +6,9 @@ # monitor netwatch and send notifications # https://git.eworm.de/cgit/routeros-scripts/about/doc/netwatch-notify.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global NetwatchNotify; :global IfThenElse; diff --git a/ospf-to-leds b/ospf-to-leds index b899b50..32027db 100644 --- a/ospf-to-leds +++ b/ospf-to-leds @@ -6,6 +6,9 @@ # visualize ospf instance state via leds # https://git.eworm.de/cgit/routeros-scripts/about/doc/ospf-to-leds.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global LogPrintExit; :global ParseKeyValueStore; diff --git a/packages-update b/packages-update index 022a110..4a2f418 100644 --- a/packages-update +++ b/packages-update @@ -6,6 +6,9 @@ # download packages and reboot for installation # https://git.eworm.de/cgit/routeros-scripts/about/doc/packages-update.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global DownloadPackage; :global LogPrintExit; :global ScriptFromTerminal; diff --git a/ppp-on-up b/ppp-on-up index 9de01b8..cf95e48 100644 --- a/ppp-on-up +++ b/ppp-on-up @@ -6,6 +6,9 @@ # run scripts on ppp up # https://git.eworm.de/cgit/routeros-scripts/about/doc/ppp-on-up.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global LogPrintExit; :local Interface $interface; diff --git a/rotate-ntp b/rotate-ntp index a0cc524..6578078 100644 --- a/rotate-ntp +++ b/rotate-ntp @@ -6,6 +6,9 @@ # rotate the ntp servers # https://git.eworm.de/cgit/routeros-scripts/about/doc/rotate-ntp.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global NtpPool; :global LogPrintExit; diff --git a/sms-action b/sms-action index a070cc9..4c39740 100644 --- a/sms-action +++ b/sms-action @@ -6,6 +6,9 @@ # run action on received SMS # https://git.eworm.de/cgit/routeros-scripts/about/doc/sms-action.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global SmsAction; :global LogPrintExit; diff --git a/sms-forward b/sms-forward index 3cfb3f0..abfea99 100644 --- a/sms-forward +++ b/sms-forward @@ -6,6 +6,9 @@ # forward SMS to e-mail # https://git.eworm.de/cgit/routeros-scripts/about/doc/sms-forward.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global Identity; :global IfThenElse; diff --git a/update-gre-address b/update-gre-address index 7dd4896..50d1373 100644 --- a/update-gre-address +++ b/update-gre-address @@ -7,6 +7,9 @@ # ipsec remote peer # https://git.eworm.de/cgit/routeros-scripts/about/doc/update-gre-address.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global LogPrintExit; / interface gre set remote-address=0.0.0.0 disabled=yes [ find where !running !disabled ]; diff --git a/update-tunnelbroker b/update-tunnelbroker index d014178..6cdb195 100644 --- a/update-tunnelbroker +++ b/update-tunnelbroker @@ -7,6 +7,9 @@ # update local address of tunnelbroker interface # https://git.eworm.de/cgit/routeros-scripts/about/doc/update-tunnelbroker.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global CertificateAvailable; :global LogPrintExit; :global ParseKeyValueStore; diff --git a/upload-backup b/upload-backup index 155603f..e16a4e5 100644 --- a/upload-backup +++ b/upload-backup @@ -6,6 +6,9 @@ # create and upload backup and config file # https://git.eworm.de/cgit/routeros-scripts/about/doc/upload-backup.md +:global GlobalFunctionsReady; +:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } + :global BackupPassword; :global BackupSendBinary; :global BackupSendExport; -- cgit v1.2.3-70-g09d2