checkOSUpdate | by xdenb43
- Created to inform about available updates via telegram
- Executed every 24h
- automatically added to scheduler with the first manual execution
- Posts info message to log if update is available
Important
works together with logEventTGInformer
# checkOSUpdate | by xdenb43
# created to work together with logEventTGInformer
# tested on RoS 7.19.6
# SCHEDULER
# warn if schedule does not exist and create it
:local scheduleName "checkOSUpdate ";
:if ([:len [/system scheduler find name="$scheduleName"]] = 0) do={
/log warning "[checkOSUpdate] Alert : Schedule does not exist. Creating schedule ...."
:delay 1
/system scheduler add name=$scheduleName interval=24h start-time=startup on-event=checkOSUpdate policy=read,write,test,policy
/log warning "[checkOSUpdate] Alert : Schedule created!"
}
:local installedVersion
:local latestVersion
/system/package/update/check-for-updates
:delay 5
:set installedVersion [/system/package/update/get installed-version]
:set latestVersion [/system/package/update/get latest-version]
:if ($latestVersion != $installedVersion) do={
/log info ("[checkOSUpdates] Info %0ANew RouterOS version available: $latestVersion")
}