How to Automatically Upgrade your Mikrotik router firmware & OS?
By automatically updating our version of Mikrotik Devices
and updating the router board, we can make our devices work more stable.
In addition, by doing this in a period of low traffic, we can ensure that our customers are least affected. We add the following scripts by pasting them in the new terminal part of our MikroTik device.
Scheduler Package upgrade
If you want your router to be updated every 7 days at 5:10 am
, you can edit the date and use this script:
1 2 3 | /system scheduler add interval=1w name="Package upgrade" on-event="system package update install" policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=may/18/2020 start-time=05:10:00 |
Scheduler Routerboard Upgrade
Performing the update of the Routerboard at 5:20
in the morning on the same day, that is, 10 minutes after the package update, will enable it to work more smoothly in terms of the system.
1 2 3 4 5 6 7 8 9 | /system scheduler add interval=1w name="Routerboard Upgrade" on-event=":global Var1\r\ \n:global Var2\r\ \n:set Var1 \"\$[/system package get system version]\"\r\ \n:set Var2 \"\$[/system routerboard get current-firmware]\"\r\ \n:if (\$Var1>\$Var2) do={/system routerboard upgrade;\r\ \n/system reboot;\r\ \n}" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=may/18/2020 start-time=\ 05:20:00 |
The output of our scripts on our Mikrotik device will look like the following.

I hope it was a useful article.