Upgrade bios firmware in script

Hello all!

I tied to run command in scipt (ver 4.xx) but nothing work! I think that command /system routerboard upgrade prompt “Yes” to accept, but in script this command not working.

# Check bios firmware

:if ( [/system routerboard get current-firmware] != [/system routerboard get upgrade-firmware] ) do={
:log error "Bios firmware different! Need upgrade"
/system routerboard upgrade
:delay 10
/system reboot
}

please, tell me where i am wrong?

Try this, worked for me when I had the same problem:

/system script
add name="Upgrade bootloader" source="/system routerboard upgrade"

and in your original script, subtitute

/system routerboard upgrade

with

/system script run "Upgrade bootloader"

it was the only way I could get it to work, on 3.29+ and some early 4.x, haven’t tried since.

Hello

Whay script stop after /system routerboard upgrade;

Look

:if ([/system routerboard get current-firmware] != [/system routerboard get upgrade-firmware]) do={
:log error "Bios need upgrade";
/system routerboard upgrade;
:delay 10;
:log error "reboot";
/system reboot} else={:log warning "Nothing"}
:log error "END"

I cant see no log after command /system routerboard upgrade


I need script to upgrade about 1000 CPE by automat
Every CPE have scheduler that download once a day script to run from FTP server

Regards.
BD

This solution works for me. It may be useful to someone

You may import this script from scheduler

/import upgrade-fw.rsc

upgrade-fw.rsc

:if ([/system routerboard get current-firmware] != [/system routerboard get upgrade-firmware]) do={
:log error "Bios need upgrade";
/system script add name="upgrade" source="/system routerboard upgrade";
/system script run upgrade;
:delay 5;
/system script remove [find name=upgrade];
:delay 5;
/system reboot} else={:log warning "Nothing"}

regards.
BD

Hi guys,
“/system routerboard upgrade” requires a user input. When you execute the command in the terminal you need to confirm it with yes or no. It is the very same when you are trying to reboot the router from the terminal window with “/system reboot”.

As ManyX mentioned you can get rid of that if you run the scripts from the scheduler. In this case the additional confirmation would not be required.

Regards

You simply need to use this:
:execute script=“/system routerboard upgrade”
:execute script=“/system reboot”

https://wiki.mikrotik.com/wiki/Manual:Scripting#Global_commands

@strods So to be clear the second execute command will not run until the first has completed?