Auto upgrade script

Hello
i was looking for some CPE auto upgrade script and have found a few in wiki but none of them fits perfect for my situation

actually the problem is users here are bit illiterate so if internet is not working they switch off cpe which might brick the cpe
what i wanted is an upgrade script that will download the files form my local server as soon as i upload them
then do a RoS + firmware upgrade then download a script file form server and run it (will use this to write new configs to cpe at once)

can any one help me in this

Thanks

You can try this
Create a small ftp server, create a share folder “/routeros/6.28/” depending on the versions you what to upgrade. Extract all the package to the folder “D:/routeros/6.28/”

On the RB that you want to upgrade do the following:
/ip dns static
add address= “Your ftp server ip” name=upgrade.mikrotik.com

/system package update
check-for-updates
:delay 1s;
:if ( [get current-version] != [get latest-version]) do={ /system package update upgrade };

Reboot RB.

can it be like it should auto reboot and during upgrade it should check the files cor corruption like if power fails while it’s rebooting or half the files downloaded then what will happen ??

Hello
i want some thing like this
http://wiki.mikrotik.com/wiki/Semi-Automating_CPE_ROS/Firmware/script_updates_and_setting_changes

but i want this to be a single step thing like i upload the files to my ftp server and it should download the packages (should download all files in the directory then reboot if any file is not downloaded then upon reboot it should not upgrade to avoid any compatibility problem)

then upon reboot firmware should be upgraded

and most important thing if cpe version is already latest it should not again download the updates

My updated auto-upgrade script is here: https://github.com/massimo-filippi/mikrotik
Fully working on 6.33.3

Hi Hrobocop, i recomend in your auto-update script add delay between load new firmware and reboot.
Like this:

   :log info ("Downloading new RouterOS on router $[/system identity get name] from $[/system package update get installed-version] to $[/system package update get latest-version] (channel:$[/system package update get channel])")     

   ## Wait for mail to be send & download FW
   :delay 15s;

   download

    ## Wait for upgrade all mikrotik in network, then reboot
   :delay 300s;

   :log info ("Upgrading RouterOS on router.")     

   /system reboot

In my net i have many Mikrotik devices, when it “all” start update at same time, on some one devices downloading has fail, because uplink(up Mikrotik) has rebooted first.

Also i add to begin
/system backup save name=disk1/before_firmware_update
Because some times Mikrotik has died on update.

It would be nice if it also checked for an updated version that is a part of the release_candidate channel and upgraded to that one if so.


Hi
is there a way to manualy upgrade my first router and use a script on this router to distribute and run these upgrades offline to other routers im my network(lan) ?
may be with their Mac address or IPs.

The script that I use is this one:
check-routeros-update on github or cgit

Its primary purpose is to notify me about updates, but now that fetch command can put results in variable (Thanks Mikrotik!) I added an auto-upgrade functionality. Only thing required is a http server to give the version.

(This depends on other scripts in the repository, see README for setup.)

What about built-in RouterOS local upgrade server? It is described below auto upgrade scripts: Look for “RouterOS can download software packages from a remote MikroTik router”.

https://wiki.mikrotik.com/wiki/Manual:Upgrading_RouterOS

Some of the Dude stuff on that page is well out of date…

you may do this
Create a small ftp server, create a share folder “/routeros/6.28/” depending on the versions you what to improve. Extract all of the package deal to the folder “D:/routeros/6.28/”

on the RB which you want to improve do the following:
/ip dns static
add address= “Your ftp server ip” call=improve.mikrotik.com

/device package update
check-for-updates
:put off 1s;
:if ( [get current-version] != [get latest-version]) do={ /system bundle update upgrade };

Reboot RB.

hi
i try backup script to ftp on 6.43.8 version
and its not working on some device
on LHG5 working 6.43.8 version os
on omnitik 5 dont work 6.43.8 version os
RB 1100AHx2 also stop working at build 6.43 > 6.42.7 working
What can be?
it stuck on upload to ftp server, and recive 0 kb file

Here is my version of auto-upgrade script, it has many features such as backup to your email before performing RouterOS upgrade process
https://github.com/beeyev/Mikrotik-RouterOS-automatic-backup-and-update

This looks fantastic - thank you for this.

beeyev,

Is there a way to have the script ONLY send the backup email IF there is a new version and an update actually occurs?

For example, I don’t want to get an email every day with a backup, but would like to get an email when a new release has been installed.

Thanks.

Yes, i have implemented this feature in a new version, check it out
https://github.com/beeyev/Mikrotik-RouterOS-automatic-backup-and-update

I do not recommend 100% automatically upgrade with new firmware.
There hare over the last years been bug or changes in the firmware that has broken some stuff.
Make sure you could delay it until you are 100% sure it does not brakes your device(s).

This has really been working out well. Thank you so much again.

Jotne’s comment is valid - perhaps that could be a tweak in future versions?

From a scheduling frequency standpoint, would it be adequate to run this every 7 days? Or is one day more desirable to catch more critical security patches? Just curious what others do.

Cheers

Hi beeyev,
Awesome script, thanks for the work and sharing it with the community here. I have a suggestion that you perhaps want to consider for a future version. In various setups I am using capsman in a mixed architecture setup. If I update the capsman master it updates and also pushes the same version to the various capsman controlled ap’s . But only if the architecture is the same. If not I need to specify a file location (/upgrade folder is what I’m using) and in that folder I have to add the .npk’s in all the different versions in use in that specific network.

It would be really great if you could add a variable that would allow to specify which additional architectures to support. And a download location where these files could be downloaded before the actual upgrade process starts.

Thanks,

Alex