2022-11-11 13:06:32 +05:30
|
|
|
# Initialize the router with default values, run backup scripts and check for updates!
|
|
|
|
|
2022-11-18 10:10:25 +05:30
|
|
|
# Version: 2
|
|
|
|
|
|
|
|
# changelog
|
|
|
|
# version: 2
|
|
|
|
# - date: 2022-11-18
|
|
|
|
# - introduction of timeout to check internet
|
|
|
|
|
2022-11-11 13:06:32 +05:30
|
|
|
:global adminEmail "noreply@example.com"
|
|
|
|
:global adminPh 9894998949
|
|
|
|
:global genericLogFileName "genericLog"
|
|
|
|
:global cloudPass ""
|
|
|
|
|
2022-11-18 10:10:25 +05:30
|
|
|
:global waitForDNS do={
|
|
|
|
:local pingIP 1
|
|
|
|
:local isUP 0
|
|
|
|
:local timeout 5
|
|
|
|
|
|
|
|
:while ( $pingIP = 1 ) do={
|
|
|
|
:do { :set $pingIP [:resolve g.co] } on-error={
|
|
|
|
:delay 60s
|
|
|
|
:set isUP ($isUP+1)
|
|
|
|
:if ($isUP = $timeout) do={ :error "Internet timed out after $timeout minutes!" }
|
|
|
|
}
|
|
|
|
}
|
2022-11-11 13:06:32 +05:30
|
|
|
}
|
|
|
|
$waitForDNS
|
|
|
|
|
2022-11-18 10:10:25 +05:30
|
|
|
# /system ntp client set enabled=yes; :delay 3s
|
2022-11-11 13:06:32 +05:30
|
|
|
|
2022-11-18 10:10:25 +05:30
|
|
|
:log info "Init script has started..."
|
2022-11-11 13:06:32 +05:30
|
|
|
|
|
|
|
/system script
|
|
|
|
|
|
|
|
:local commonScripts {"backup-cron"; "backup-scripts"; "cloud-backup"; "firmware-check-rb"; "firmware-check-ros";}
|
|
|
|
:local initScripts ($commonScripts, "firmware-check-lte")
|
|
|
|
|
2022-11-18 10:10:25 +05:30
|
|
|
:foreach scriptName in $initScripts do={
|
2022-11-11 13:06:32 +05:30
|
|
|
:do { run $scriptName } on-error={ :log error "Error running the script $scriptName\n" }
|
|
|
|
:delay 30s
|
|
|
|
}
|
|
|
|
|
2022-11-18 10:10:25 +05:30
|
|
|
:log info "Init script finished execution!"
|