Community discussions

MikroTik App
 
kgninfos
Member
Member
Topic Author
Posts: 387
Joined: Thu Jun 21, 2012 7:34 pm
Location: Earth
Contact:

Auto upgrade script

Fri May 15, 2015 8:28 pm

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
 
User avatar
Bigfoot
Frequent Visitor
Frequent Visitor
Posts: 76
Joined: Sat Jan 15, 2011 10:41 am
Location: South Africa

Re: Auto upgrade script

Mon May 18, 2015 7:55 pm

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.
 
kgninfos
Member
Member
Topic Author
Posts: 387
Joined: Thu Jun 21, 2012 7:34 pm
Location: Earth
Contact:

Re: Auto upgrade script

Fri May 22, 2015 10:52 pm

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 ??
 
kgninfos
Member
Member
Topic Author
Posts: 387
Joined: Thu Jun 21, 2012 7:34 pm
Location: Earth
Contact:

Re: Auto upgrade script

Tue Jul 21, 2015 6:37 pm

Hello
i want some thing like this
http://wiki.mikrotik.com/wiki/Semi-Auto ... ng_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
 
User avatar
Hrobocop
just joined
Posts: 23
Joined: Sun Dec 04, 2011 12:07 pm
Location: Prague

Re: Auto upgrade script

Wed Dec 09, 2015 4:09 pm

My updated auto-upgrade script is here: https://github.com/massimo-filippi/mikrotik
Fully working on 6.33.3
 
User avatar
shodan
newbie
Posts: 30
Joined: Sun Dec 01, 2013 3:26 pm
Location: Tula, Russia
Contact:

Re: Auto upgrade script

Mon Dec 14, 2015 8:18 pm

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.
 
Zero3K
just joined
Posts: 17
Joined: Sat Apr 22, 2017 11:25 pm
Location: Louisville, KY, USA

Re: Auto upgrade script

Sat Apr 29, 2017 7:02 pm

My updated auto-upgrade script is here: https://github.com/massimo-filippi/mikrotik
Fully working on 6.33.3
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.
 
gledishia
just joined
Posts: 1
Joined: Wed Dec 05, 2018 12:22 pm

Re: Auto upgrade script

Wed Dec 05, 2018 12:41 pm

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.
----------------
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.
 
User avatar
eworm
Forum Guru
Forum Guru
Posts: 1070
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Auto upgrade script

Wed Dec 12, 2018 11:14 pm

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.)
 
User avatar
strods
MikroTik Support
MikroTik Support
Posts: 1623
Joined: Wed Jul 16, 2014 7:22 am
Location: Riga, Latvia

Re: Auto upgrade script

Wed Dec 12, 2018 11:52 pm

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:U ... g_RouterOS
 
sid5632
Long time Member
Long time Member
Posts: 553
Joined: Fri Feb 17, 2017 6:05 pm

Re: Auto upgrade script

Thu Dec 13, 2018 2:48 am

Some of the Dude stuff on that page is well out of date...
 
fouad2000
just joined
Posts: 1
Joined: Mon Dec 17, 2018 7:03 pm

Re: Auto upgrade script

Mon Dec 17, 2018 7:06 pm

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.)
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.
 
dadoremix
Member Candidate
Member Candidate
Posts: 133
Joined: Sat May 14, 2011 11:31 am

Re: Auto upgrade script

Sat Dec 22, 2018 3:47 am

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

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
 
beeyev
just joined
Posts: 11
Joined: Wed Aug 08, 2018 3:00 pm

Re: Auto upgrade script

Sun Jan 26, 2020 9:30 pm

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-Rout ... and-update
 
RackKing
Member
Member
Posts: 380
Joined: Wed Oct 09, 2013 1:59 pm

Re: Auto upgrade script

Wed Jan 29, 2020 6:42 pm

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-Rout ... and-update
This looks fantastic - thank you for this.
 
tabate47
Long time Member
Long time Member
Posts: 510
Joined: Wed Mar 13, 2013 5:23 am
Location: Los Angeles

Re: Auto upgrade script

Tue Mar 31, 2020 4:56 am

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.
 
beeyev
just joined
Posts: 11
Joined: Wed Aug 08, 2018 3:00 pm

Re: Auto upgrade script

Sun Apr 26, 2020 10:35 pm

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-Rout ... and-update
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3292
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Auto upgrade script

Mon Apr 27, 2020 12:06 am

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).
 
RackKing
Member
Member
Posts: 380
Joined: Wed Oct 09, 2013 1:59 pm

Re: Auto upgrade script

Wed Apr 29, 2020 4:55 am

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
 
User avatar
alexvdbaan
Trainer
Trainer
Posts: 40
Joined: Sun Feb 22, 2015 12:12 pm
Location: Amsterdam, Netherlands
Contact:

Re: Auto upgrade script

Thu Apr 30, 2020 8:34 am

Yes, i have implemented this feature in a new version, check it out
https://github.com/beeyev/Mikrotik-Rout ... and-update
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

Who is online

Users browsing this forum: drpioneer, patrikg and 28 guests