Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save xdenb43/fbdf6475b9f5b12f71e2d8651156d1f9 to your computer and use it in GitHub Desktop.

Select an option

Save xdenb43/fbdf6475b9f5b12f71e2d8651156d1f9 to your computer and use it in GitHub Desktop.
Mikrotik inform about new RouterOS to Telegram.md

checkOSUpdate | by xdenb43

Specs

  • 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

Notification example

Screenshot 2025-10-09 211728

Script

# 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")
}

UI окно System - Scripts

Screenshot 2025-10-09 211907
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment