2022-11-11 13:06:32 +05:30
|
|
|
# Initialize the router with default values, run backup scripts and check for updates!
|
|
|
|
|
2025-06-03 05:49:53 +05:30
|
|
|
# Note: The policy of the script should match the policy of the scheduler that calls this script.
|
|
|
|
|
|
|
|
# Version: 4
|
|
|
|
|
|
|
|
# change log
|
|
|
|
# version: 4
|
|
|
|
# - date: 2025-05-31
|
|
|
|
#. - do not execute backup scripts after 12 noon.
|
|
|
|
# version: 3
|
|
|
|
# - date: 2023-08-20
|
|
|
|
# - use NTP client to test for internet.
|
|
|
|
# - No more timeout for stable internet. Wait indefinitely until stable internet.
|
2022-11-18 10:10:25 +05:30
|
|
|
# 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 cloudPass ""
|
2025-06-03 05:49:53 +05:30
|
|
|
:global minSpeed 0
|
2022-11-11 13:06:32 +05:30
|
|
|
|
2025-06-03 05:49:53 +05:30
|
|
|
:while ( ([/system/ntp/client print as-value])->"status" != "synchronized" ) do={
|
|
|
|
:delay 60s;
|
|
|
|
# :log info "No internet, yet."
|
2022-11-11 13:06:32 +05:30
|
|
|
}
|
2025-06-03 05:49:53 +05:30
|
|
|
:log info "Init script execution has started."
|
|
|
|
:log info "Connected to internet. Time synced."
|
2022-11-11 13:06:32 +05:30
|
|
|
|
2025-06-03 05:49:53 +05:30
|
|
|
:local commonScripts {"firmware-check-rb"; "firmware-check-ros";}
|
2022-11-11 13:06:32 +05:30
|
|
|
:local initScripts ($commonScripts, "firmware-check-lte")
|
|
|
|
|
2025-06-03 05:49:53 +05:30
|
|
|
/system script
|
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
|
|
|
|
}
|
|
|
|
|
2025-06-03 05:49:53 +05:30
|
|
|
:local currentHour [:tonum [:pick [/system clock get time] 0 2]]
|
|
|
|
|
|
|
|
:local backupScripts {"backup-cron"; "backup-scripts"}
|
|
|
|
:if ($currentHour < 7) do={
|
|
|
|
:foreach scriptName in $backupScripts do={
|
|
|
|
:do { run $scriptName } on-error={:log error "Error running $scriptName"}
|
|
|
|
:delay 30s
|
|
|
|
}
|
|
|
|
} else={
|
|
|
|
:log info "Automated backups aren't taken after 7am."
|
|
|
|
}
|
|
|
|
|
|
|
|
:log info "Init script execution is completed."
|