mirror of
https://github.com/pothi/mikrotik-scripts.git
synced 2025-06-26 07:58:37 +02:00
Introduce timeout for checking internet
This commit is contained in:
parent
fd35e525bc
commit
69023b21f8
1 changed files with 17 additions and 1 deletions
|
@ -1,23 +1,39 @@
|
|||
# Initialize the router with default values, run backup scripts and check for updates!
|
||||
|
||||
# Version: 2
|
||||
|
||||
# changelog
|
||||
# version: 2
|
||||
# - date: 2022-11-18
|
||||
# - introduction of timeout to check internet
|
||||
|
||||
:global adminEmail "noreply@example.com"
|
||||
:global cloudPass ""
|
||||
|
||||
:local isUP 0
|
||||
:local timeout 5
|
||||
|
||||
/interface/detect-internet
|
||||
set detect-interface-list=WAN
|
||||
state
|
||||
|
||||
:do {
|
||||
:delay 60s
|
||||
:set $internetStatus ([:pick [print as-value] 0]->"state")
|
||||
# :log info "Waiting for internet..."
|
||||
|
||||
:set isUP ($isUP+1)
|
||||
:if ($isUP = $timeout) do={ :error "Internet timed out after $timeout minutes!" }
|
||||
|
||||
} while ($internetStatus != "internet")
|
||||
|
||||
# :log info "Connected to internet."
|
||||
|
||||
:log info "Init script started."
|
||||
|
||||
/system script
|
||||
|
||||
:local commonScripts {"backup-cron"; "backup-scripts"; "cloud-backup"; "firmware-check"}
|
||||
:local commonScripts {"backup-buttons"; "backup-cron"; "backup-scripts"; "cloud-backup"; "firmware-check"}
|
||||
:local initScripts ("enable-wifi", $commonScripts)
|
||||
|
||||
:foreach scriptName in $initScripts do={
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue