Community discussions

MikroTik App
 
RaynoP
newbie
Topic Author
Posts: 34
Joined: Thu Jun 30, 2011 10:59 am

Upgrade Firmware via script with no user intervention

Tue Jun 11, 2013 2:07 pm

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
 
RaynoP
newbie
Topic Author
Posts: 34
Joined: Thu Jun 30, 2011 10:59 am

Re: Upgrade Firmware via script with no user intervention

Tue Jun 11, 2013 8:38 pm

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
 
welan
newbie
Posts: 39
Joined: Thu Jul 10, 2008 12:06 am
Location: Italy
Contact:

Re: Upgrade Firmware via script with no user intervention

Sun Feb 23, 2014 8:26 pm

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";
}
 
RGuilhas
just joined
Posts: 1
Joined: Tue Jun 20, 2006 8:50 pm

Re: Upgrade Firmware via script with no user intervention

Sat Mar 15, 2014 11:23 pm

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"
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12632
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Upgrade Firmware via script with no user intervention

Sun Mar 16, 2014 12:14 am

:put y???

:put /r???


It's a Joke?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12632
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Upgrade Firmware via script with no user intervention

Sun Mar 16, 2014 12:22 am

:put "xxx" do not pass a parameter to a function...

Good fortune.
Last edited by rextended on Mon Mar 20, 2023 5:59 pm, edited 1 time in total.
 
ckgth
Frequent Visitor
Frequent Visitor
Posts: 77
Joined: Wed Jun 06, 2007 5:03 pm

Re: Upgrade Firmware via script with no user intervention

Tue Mar 18, 2014 9:35 pm

Hi,

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

regards
Christian
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12632
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Upgrade Firmware via script with no user intervention

Tue Mar 18, 2014 10:27 pm

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.
 
ckgth
Frequent Visitor
Frequent Visitor
Posts: 77
Joined: Wed Jun 06, 2007 5:03 pm

Re: Upgrade Firmware via script with no user intervention

Tue Mar 18, 2014 10:51 pm

Hi,

you are right!
Many thanks.

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