Upgrade Firmware via script with no user intervention

Hi,

This question probably was asked and answered many times before:
How do I upgrade a routers firmware and restart it without pressing Y in the terminal?

I found another thread that showed how to dynamically import the rsc file but it does not seem to work perfectly. It still requires user input.

I have a couple of routers I need to upgrade ROS from a webserver which is not connected to the internet and want to automate the process.

I tried the normal script command:

/system routerboard upgrade

RaynoP

It seems like future version will have the feature as per response from support:

I’m sorry, I have checked with firmware update, currently it seems there is software issue, that is going to be fixed in the upcoming versions.

RaynoP

Hi, I’m looking to make the same script, this is the code, what was wrong?

:global oldfirm [/system routerboard get current-firmware];
:global newfirm [/system routerboard get upgrade-firmware];
:if ([$oldfirm]<[$newfirm]) do={
/system routerboard upgrade;
:put “\r”;
:delay 1s;
:put “y”;
/system reboot;
:put “y”;
}

Try This worked for me

/system script
add name=firmware policy=
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api
source=“\r
\n:delay 30\r
\n:global oldfirm [/system routerboard get current-firmware];\r
\n:global newfirm [/system routerboard get upgrade-firmware];\r
\n:if ([$oldfirm]<[$newfirm]) do={\r
\n/system routerboard upgrade}\r
\n:put "y"\r
\n:delay 60\r
\n:if ([$oldfirm]<[$newfirm]) do={/system reboot}\r
\n:put "y"\r
\n\r
\n”

:put y???

:put /r???


It’s a Joke?

:put “xxx” do not pass a parameter to a function…

Good fortune.

Hi,

no. When i use you code, then the router will request for an “y(es)” ?!

regards
Christian

Only if you manually paste on terminal.
You must put inside a script called by scheduler.

Hi,

you are right!
Many thanks.

but: manualy run the script from terminal is also not going. But with sheduler only, it works fine!