mirror of
https://github.com/pothi/mikrotik-scripts.git
synced 2025-06-21 13:49:01 +02:00
Add init script
This commit is contained in:
parent
a1a0489377
commit
ebbedef292
1 changed files with 28 additions and 0 deletions
28
scripts/init.rsc
Normal file
28
scripts/init.rsc
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Initialize the router with default values, run backup scripts and check for updates!
|
||||
|
||||
:global adminEmail "noreply@example.com"
|
||||
:global cloudPass ""
|
||||
|
||||
/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..."
|
||||
} 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 initScripts ("enable-wifi", $commonScripts)
|
||||
|
||||
:foreach scriptName in $initScripts do={
|
||||
:do { run $scriptName } on-error={:log error "Error running $scriptName"}
|
||||
:delay 30s
|
||||
}
|
||||
|
||||
:log info "Init script ended."
|
Loading…
Add table
Add a link
Reference in a new issue