How to register a global hotkey for your application in C#

How to register a global hotkey for your application in C#

Register a hotkey for your application that can be triggered even if your form is minimized and does not have focus. More »

How to download a file in C# (progressbar and download speed)

How to download a file in C# (progressbar and download speed)

Learn how to download files in C# while displaying the percentage and the download speed. More »

UDP hole punching implementation in C#

UDP hole punching implementation in C#

Learn how to implement UDP hole punching so you can make your clients life a lot easier by not forcing them to open ports on their end. More »

 

Automatically check for MikroTik software updates

MikroTik Logo

If you own multiple MikroTik devices (or even one) you already know how annoying and time consuming it is to keep checking if there are new updates available for your devices all the time.

The purpose of this tutorial is to help you setup your devices in order to receive an email notification if a new software update is available to download for your device.

Step 1

First of all, we need to setup the SMTP settings of your MikroTik device to allow it to send emails when required.

Using WinBox, or the web interface, navigate to Tools --> Email and change your settings as shown in the image below. Please note that the image contains sample data and requires from you to change the settings with a working SMTP as well the correct credentials, if required.

mikrotik smtp settings

If you prefer to use the CLI over the web interface or WinBox, you can use the command below:

Make sure to send a test email to verify that everything is working properly.

Step 2

Now that our MikroTik device is able to send emails it is time to create our script which will be responsible for checking for new updates and sending us an email if one is available.

Navigate to System --> Scripts, click Add, change the title to “Check for software updates” or to something else if you prefer (don’t forget the name, you will need it in step 3) and finally, paste the following script in the source area:

CLI Version (pay attention to the highlighted line)

Step 3

It is time for the last step. In order for everything to work properly, we need to trigger our script every now and then in order for the update check to take place. To accomplish this, we will use the scheduler feature which is located under System --> Scheduler

Simply add a new scheduled task, give it a name and specify how often it should run in the interval section (I run mine with a 2d 00:00:00 interval).

In the “On Event” section paste the line below.

Important: Make sure the name of the script is exactly the same as the one you have created in step 2!

CLI Version

And you are done! If you have successfully followed this example your MikroTik device will check every 2 days for new updates and will let you know by email if one is available.

This method has been tested in the last few versions of RouterOS (currently 6.38). For older versions you might need to alter the script functions a bit to get everything working correctly.

If you have any questions don’t hesitate to ask them in the comment section below.

Update: As of v6.43.7 the release channels have been renamed. If you want to use the above script on a MikroTik that is running an older RouterOS version you will need to use the old software update channel name.

For RouterOS equal or newer than v6.43.7

For RouterOS older than v6.43.7

* release channels renamed – “bugfix” to “long-term”, “current” to “stable” and “release candidate” to “testing”

Share on FacebookTweet about this on TwitterShare on Google+Share on StumbleUponShare on LinkedInShare on RedditPin on PinterestShare on TumblrDigg thisPrint this pageEmail this to someone

10 Responses to Automatically check for MikroTik software updates

  1. Tyler says:

    here is another script for automatic update and backup to an email
    https://github.com/beeyev/Mikrotik-RouterOS-automatic-backup-and-update

  2. MIhail, Lazar says:

    My version of script that runs on the latest 6.44.3 version is:

  3. Freek says:

    Script no longer works since version 6.43.7 (2018-Nov-30).
    This is because the release channels have been renamed.

    In order to fix the script, change the following line:
    ‘set channel=current’
    to
    ‘set channel=stable’

  4. Andreas Kiessling says:

    My script version looks like:

    Works for me on 6.42.3 …

  5. Ian High says:

    no longer works in 6.42.6 The check-for-updates command causes subsequent command lines to be lost while the check is performed. Trying to introduce a :delay 15s; line is not a solution as this line gets ‘eaten’ by the check-for-updates command

    • CooLMinE says:

      Can’t replicate this in the terminal since everything seems to be working as expected there. I will let you know as soon as an update becomes available.

    • CooLMinE says:

      I’ve tested it with the new version that was just released (6.42.7) and everything seems to be working

    • Petr says:

      You need update script:

      /system package update
      check-for-updates once
      :delay 1s;
      :if ( [get status] = “New version is available”) do={…

  6. Freek says:

    Thank you very much! Works great

Leave a Reply

Your email address will not be published. Required fields are marked *