mirror of
https://github.com/pothi/mikrotik-scripts.git
synced 2025-08-03 01:14:27 +02:00
Better docs
This commit is contained in:
parent
f78b1a159b
commit
97345bd33b
5 changed files with 63 additions and 56 deletions
39
scripts/alert-on-new-ros-version.rsc
Normal file
39
scripts/alert-on-new-ros-version.rsc
Normal file
|
@ -0,0 +1,39 @@
|
|||
# Alert upon new version
|
||||
|
||||
# requirement/s: $adminEmailAddress
|
||||
:local adminEmailAddress "admin@example.com"
|
||||
|
||||
:log info "Checking for new version of RouterOS..."
|
||||
|
||||
# if you run this script at "startup",
|
||||
# the following indicates the time for the internet to go "up"
|
||||
:delay 60s
|
||||
|
||||
/system package update
|
||||
|
||||
check-for-updates once
|
||||
|
||||
:local verionStatus
|
||||
|
||||
:do {
|
||||
:delay 2s
|
||||
|
||||
:set $versionStatus [get status]
|
||||
# alternative way to get the above info
|
||||
# :set $versionStatus ([print as-value]->"status")
|
||||
} while=( $versionStatus = "finding out latest version..." )
|
||||
|
||||
# for debugging
|
||||
# :put $versionStatus
|
||||
# :put $adminEmailAddress
|
||||
|
||||
:if ( $versionStatus = "New version is available" ) do={
|
||||
# alternative method
|
||||
# :if ( [get installed-version] != [get latest-version] ) do={
|
||||
:log info "A new firmware is available for Router OS and an email is probably sent to $adminEmailAddress."
|
||||
/tool e-mail send to="$adminEmailAddress" \
|
||||
subject="[Mikrotik] Software Update is Available" \
|
||||
body="A new update is available for your MikroTik device"
|
||||
} else={
|
||||
:log info "System is already up to date"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue