We have used the dude to mass upgrade RouterOS software.
Is there a way to use it to mass update the firmware and trigger a reboot?
:local email "joe@user.com"
/system package update
set channel=current
check-for-updates
:if ([get installed-version] != [get latest-version]) do={
download
/tool e-mail send to="$email" subject="Upgrading RouterOS on router $[/system identity get name]" body="Upgrading 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])"
:log info ("Upgrading 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])")
/system scheduler
add interval=1d name=UPDATE2 on-event=UPDATE2 policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon,dude start-date=feb/25/2011 start-time=23:55:00
}
/system scheduler
rem [find name=UPDATE2]
/system reboot
/system script
add name=Autoupdater owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="system package update check-for-updates\r\
\n:global FWstatus [/system package update get status];\r\
\n\r\
\nif (\$FWstatus = \"New version is available\") do={system package update download; delay delay-time=3600; system reboot} else={}"
/system scheduler
add interval=1w name="Sunday Midnight" on-event="system script run Autoupdater" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=dec/03/2017 start-time=00:00:00
add interval=1w name="Saturday Midnight" on-event="system script run Email configuration backup" policy=\
Hi,Thread Mining I know, as always there are many ways to skin the cat so here is how I get my units to update.Code: Select all/system script add name=Autoupdater owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="system package update check-for-updates\r\ \n:global FWstatus [/system package update get status];\r\ \n\r\ \nif (\$FWstatus = \"New version is available\") do={system package update download; delay delay-time=3600; system reboot} else={}" /system scheduler add interval=1w name="Sunday Midnight" on-event="system script run Autoupdater" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-date=dec/03/2017 start-time=00:00:00 add interval=1w name="Saturday Midnight" on-event="system script run Email configuration backup" policy=\
Sunday midnight they download the packages if there is an update and reboot 1 hour later.
I delay the reboot so everyone has a good chance of downloading the packages, on rare occasions Mikrotik change things that creates a compatibility issue between ROS versions.
Upgrade will not be done if there's a power loss. It has turned be a reboot.Hi,Thread Mining I know, as always there are many ways to skin the cat so here is how I get my units to update.Code: Select all/system script add name=Autoupdater owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="system package update check-for-updates\r\ \n:global FWstatus [/system package update get status];\r\ \n\r\ \nif (\$FWstatus = \"New version is available\") do={system package update download; delay delay-time=3600; system reboot} else={}" /system scheduler add interval=1w name="Sunday Midnight" on-event="system script run Autoupdater" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-date=dec/03/2017 start-time=00:00:00 add interval=1w name="Saturday Midnight" on-event="system script run Email configuration backup" policy=\
Sunday midnight they download the packages if there is an update and reboot 1 hour later.
I delay the reboot so everyone has a good chance of downloading the packages, on rare occasions Mikrotik change things that creates a compatibility issue between ROS versions.
I want to ask you something that I'm curious about it, in this script all device will reboot same time, if device powerbox and this powerbox supply voltage to some SXTs on it . what happen if SXTs and powerbox reboot it self at same time for upgrade ? is powerbox or OmniTik UPA will not cut power to devices that connected on it while upgrading ?
Thanxx
while upgrading if power loss nothing will happen ? if its true its goodUpgrade will not be done if there's a power loss. It has turned be a reboot.Hi,Thread Mining I know, as always there are many ways to skin the cat so here is how I get my units to update.Code: Select all/system script add name=Autoupdater owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="system package update check-for-updates\r\ \n:global FWstatus [/system package update get status];\r\ \n\r\ \nif (\$FWstatus = \"New version is available\") do={system package update download; delay delay-time=3600; system reboot} else={}" /system scheduler add interval=1w name="Sunday Midnight" on-event="system script run Autoupdater" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-date=dec/03/2017 start-time=00:00:00 add interval=1w name="Saturday Midnight" on-event="system script run Email configuration backup" policy=\
Sunday midnight they download the packages if there is an update and reboot 1 hour later.
I delay the reboot so everyone has a good chance of downloading the packages, on rare occasions Mikrotik change things that creates a compatibility issue between ROS versions.
I want to ask you something that I'm curious about it, in this script all device will reboot same time, if device powerbox and this powerbox supply voltage to some SXTs on it . what happen if SXTs and powerbox reboot it self at same time for upgrade ? is powerbox or OmniTik UPA will not cut power to devices that connected on it while upgrading ?
Thanxx
On a personal note (take it for what it's worth), I'm always fearful about mass (automated) upgrades. If something goes wrong, what then? Yes, it's long, but I prefer 1 by 1. I've had occurrences of upgrade bugs. You're better off knowing now than finding about it in the morning.
Regards,
Sent from Tapatalk
On powercycle Update package not install, When reboot a device Update package installing , So I found a program for ssh and sending command to download update first and after sending reboot command to all device step by step every 4 min. Program sent reboot command wait 4 minute and sent command to another device. this is most stable method for me for upgrading many device.Of course when the router is providing power supply to the access points it is dangerous to update them at exactly the
same time as the power will be cut when the access points are doing the flash writes...
What is true in that posting: when the files are downloaded (and the device has big flash) and then the power is cycled,
the update is not done. I found that when I downloaded the update on many routers guessing that they would update
at the next powercycle, but that did not happen.
Yes that is the better way, not all at the same time (using scheduled job) but at different times.On powercycle Update package not install, When reboot a device Update package installing , So I found a program for ssh and sending command to download update first and after sending reboot command to all device step by step every 4 min. Program sent reboot command wait 4 minute and sent command to another device. this is most stable method for me for upgrading many device.
Then at least you need a different install time for powering- and powered devices.Yes that is the better way, not all at the same time (using scheduled job) but at different times.
With Linux I would use a combination of "ssh" and "expect" to do that. With "expect" you can program a multi-step procedure that
would login to the device, check the current version, when required download an update, reboot to install it, login again after a
couple of minutes to verify that the device came back and the software indeed was upgraded, and finish.
Around that I would program a loop (probably in the shell) to call this procedure one by one for every device that has to be upgraded
and stop when something unexpected happens.
I have done this at work to upgrade switches (different manuf) and it worked fine.
Of course it would cause multiple network interruptions, compared to the method where first the firmware was downloaded
everywhere and then a reboot at the same time at all routers. However, that method is not safe when power over ethernet
is in use!
good idea, It will take a time to prepare devices in category's but I will do it.Then at least you need a different install time for powering- and powered devices.
It possible it will do that, but if it does the SXT will upgrade itself next week.Hi,
I want to ask you something that I'm curious about it, in this script all device will reboot same time, if device powerbox and this powerbox supply voltage to some SXTs on it . what happen if SXTs and powerbox reboot it self at same time for upgrade ? is powerbox or OmniTik UPA will not cut power to devices that connected on it while upgrading ?
Thanxx
I have never tried it with MikroTik equipment but usually when doing software upgrades there is a prominent "do not remove power during upgrade" warning and I think it would be unwise to remove power from the SXT precisely at the time it is doing its upgrade (i.e. around the reboot phase).It possible it will do that, but if it does the SXT will upgrade itself next week.
Will today I had a little drive to go correct one of these. Mass upgrading at the same time seems to not really be an issue, one of my networks with two POE devices seems to handle it fine and always has for about 2 years. The other one which I freshly installed two weeks ago didn't have the time synched across all the devices and well that caused a few issues when some of the POE powered devices were still doing upgrades when the supplying device rebooted.I have never tried it with MikroTik equipment but usually when doing software upgrades there is a prominent "do not remove power during upgrade" warning and I think it would be unwise to remove power from the SXT precisely at the time it is doing its upgrade (i.e. around the reboot phase).
system script add dont-require-permissions=no name=Autoupdater owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="system package \
update check-for-updates \r\
\n:global FWstatus [/system package update get status];\r\
\n:do {:global POEstatus ([/interface ethernet poe monitor ether5 once as-value ]->\"poe-out-status\");} on-error={:global POEstatus \"fail\"}\r\
\nif (\$FWstatus = \"New version is available\") do={:system package update download; if (\$POEstatus = \"powered-on\") do={:delay delay-time=3900} else\
={delay delay-time=3600}; :system reboot} else={}"
/system script
add dont-require-permissions=no name=Autoupdater owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="system package \
update check-for-updates \r\
\n:global FWstatus [/system package update get status];\r\
\n:global POEstatus \"blank\"\r\
\n:do {:global POEstatus ([/interface ethernet poe monitor ether5 once as-value ]->\"poe-out-status\");} on-error={:global POEstatus \"fail\"}\r\
\nif (\$POEstatus = \"powered-on\") do={:delay delay-time=3900} else={delay delay-time=3600};\r\
\nif (\$FWstatus = \"New version is available\") do={:system package update download; :system reboot} else={}\r\
\n"
/system scheduler
add dont-require-permissions=no name=Autoupdater owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="system package update check-for-updates \r\
\n:global FWstatus [/system package update get status];\r\
\nif (\$FWstatus = \"New version is available\") do={:system package update download} else={/quit}\r\
\n:global POEstatus \"blank\"\r\
\n:do {:global POEstatus ([/interface ethernet poe monitor ether5 once as-value ]->\"poe-out-status\");} on-error={:global POEstatus \"fail\"}\r\
\n if (\$POEstatus = \"powered-on\") do={:delay delay-time=3900} else={:delay delay-time=3600}\r\
\n/system reboot\r\
\n\r\
\n"
/system routerboard settings set auto-upgrade=yes
helipos wrote some junk code...
/system scheduler
add interval=1w name=Sunday_0000hrs on-event="system script run Autoupdate" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=2018-08-26 start-time=00:00:00
add interval=1w name=Sunday_0100hrs on-event="system script run Autoupdate_reboot" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=2018-08-26 start-time=01:00:00
/ system script
add dont-require-permissions=no name=Autoupdate owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":log info \"Autoupdater start\"\r\
\n:global FWstatus BLANK\r\
\ndelay 5\r\
\n/system package update check-for-updates;:global FWstatus [/system package update get status]\r\
\ndelay 5\r\
\nif (\$FWstatus = \"System is already up to date\") do={:log info \$FWstatus;/quit} else={}\r\
\nif (\$FWstatus = \"New version is available\") do {:log info \$FWstatus}\r\
\n\r\
\nsystem package update download\r\
\n:global FWstatus [/system package update get status]\r\
\n\r\
\nif (\$FWstatus = \"Downloaded, please reboot router to upgrade it\") do={:log info \"Autoupdater downloaded first go\"} else={}\r\
\nif (\$FWstatus = \"ERROR: connection timed out\") do={delay 60;system package update download;:global FWstatus [/system package update get status]}} else={quit}\r\
\nif (\$FWstatus = \"ERROR: connection timed out\") do={delay 120;system package update download;:global FWstatus [/system package update get status]}} else={quit}\r\
\nif (\$FWstatus = \"ERROR: connection timed out\") do={delay 180;system package update download;:global FWstatus [/system package update get status]}} else={quit}\r\
\nif (\$FWstatus = \"ERROR: connection timed out\") do={delay 240;system package update download;:global FWstatus [/system package update get status]}} else={quit}\r\
\nif (\$FWstatus = \"ERROR: connection timed out\") do={delay 300;system package update download;:global FWstatus [/system package update get status]}} else={quit}\r\
\nif (\$FWstatus = \"ERROR: connection timed out\") do={:log info \"Autoupdater failed to download, continual timeouts\";quit else={quit}\r\
\n"
add dont-require-permissions=no name=Autoupdate_reboot owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":log info \"Autoupdater reboot check started\"\r\
\nif (\$FWstatus = \"Downloaded, please reboot router to upgrade it\") do={:log info [\$FWstatus]} else={log info [\$FWstatus]}\r\
\n:do {:global POEstatus ([/interface ethernet poe monitor ether5 once as-value ]->\"poe-out-status\");} on-error={:global POEstatus \"fail\"}\r\
\n if (\$POEstatus = \"powered-on\") do={:delay delay-time=(300)} else={/system reboot}\r\
\n"