Community discussions

MUM Europe 2020
 
RaynoP
newbie
Topic Author
Posts: 33
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: 33
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: 37
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: 2950
Joined: Tue Feb 25, 2014 12:49 pm
Location: Capalbio, Tuscany, Italy

Re: Upgrade Firmware via script with no user intervention

Sun Mar 16, 2014 12:14 am

:put y???

:put /r???


It's a Joke?
I'm Italian, not English. Sorry for my imperfect grammar.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 2950
Joined: Tue Feb 25, 2014 12:49 pm
Location: Capalbio, Tuscany, Italy

Re: Upgrade Firmware via script with no user intervention

Sun Mar 16, 2014 12:22 am

Use this script [ it also check the bios version before upgrade]:
/system script add name=biosup policy=reboot,read,write source=":if ( [ /system routerboard get upgrade-firmware ] > [ /system routerboard get current-firmware ] ) do={ /system routerboard upgrade; /delay delay-time=10; /system reboot }";
you can run the script directly on the console [or by "ros_command" on "the dude"]:
/system script run biosup;
or schedule the running each day @ 04:00 AM:
add interval=1d disabled=no name=auto_bios_upgrade on-event="/system script run biosup;" policy=reboot,read,write start-date=Jan/09/1970 start-time=04:00:00
reboot / reset / upgrade / etc. never request to press "y" when launched from a script.

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

Good fortune.
I'm Italian, not English. Sorry for my imperfect grammar.
 
ckgth
Frequent Visitor
Frequent Visitor
Posts: 64
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: 2950
Joined: Tue Feb 25, 2014 12:49 pm
Location: Capalbio, Tuscany, Italy

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.
I'm Italian, not English. Sorry for my imperfect grammar.
 
ckgth
Frequent Visitor
Frequent Visitor
Posts: 64
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!

Who is online

Users browsing this forum: Defm, sumguy555 and 22 guests