Community discussions

 
Nutcracker
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Mon Jun 04, 2007 5:03 pm

RB upgrade script issues

Thu Jun 21, 2018 3:14 pm

Hi all

Below is the script and scheduler items that I am busy testing out.
Problem is that it seems to work sometimes, but when I leave it to run on it's own at 05:00, it doesn't complete and simply loops.

Am I missing a semi-colon or something?
Any assistance would be appreciated.

Code: Select all

/system scheduler
add interval=1d name=upgrade on-event=rb_upgrade policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive start-date=\
jun/16/2018 start-time=05:00:00
add name=startup_upgrade on-event=rb_upgrade policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive start-time=\
startup
/system script
add name=rb_upgrade owner=firstline policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive source=":log info\
\_\"Checking for RouterOS upgrades\";\r\
\n/system package update install\r\
\n:log info \"Checked for RouterOS upgrades\";\r\
\n:log info \"Checking firmware...\";\r\
\n/system routerboard\r\
\n:if ([get current-firmware] != [get upgrade-firmware]) do={\r\
\n :log info \"Updating firmware\";\r\
\n upgrade;\r\
\n # Automatic restart\r\
\n :delay 2s\r\
\n /system reboot\r\
\n } else={\r\
\n :log info \"No update.\"\r\
\n }\r\
\n"
 
Nutcracker
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Mon Jun 04, 2007 5:03 pm

Re: RB upgrade script issues

Fri Jun 22, 2018 8:22 am

Some more info this morning:

Code: Select all

05:00:00 script,info Checking for RouterOS upgrades
05:00:00 script,info Checked for RouterOS upgrades
05:00:00 script,info Checking firmware...
05:00:00 script,info No update.
This is what I am getting on most router's this morning, yet they are not upgrading to 6.42.4(they are on 6.42.3).

Once again I ask, am I doing something wrong?
If you guys need any additional info, please let me know.
 
User avatar
dasiu
Trainer
Trainer
Posts: 232
Joined: Fri Jan 30, 2009 11:41 am
Location: Reading, UK
Contact:

Re: RB upgrade script issues

Fri Jun 22, 2018 11:06 am

I'd add some debugging info:
/system scheduler
add interval=1d name=upgrade on-event=rb_upgrade policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive start-date=jun/16/2018 start-time=05:00:00
add name=startup_upgrade on-event=rb_upgrade policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive start-time=startup
/system script
add name=rb_upgrade owner=firstline policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive source=":log info \"Checking for RouterOS upgrades\";\r\
\n/system package update install\r\
\n:log info \"Checked for RouterOS upgrades\";\r\
\n:log info \"Checking firmware...\";\r\
\n/system routerboard\r\
\n:local oldfw [get current-firmware]\r\
\n:local newfw [get upgrade-firmware]\r\
\n:if (\$oldfw != \$newfw) do={\r\
\n :log info \"Updating firmware from \$oldfw to \$newfw\";\r\
\n upgrade;\r\
\n # Automatic restart\r\
\n :delay 2s\r\
\n /system reboot\r\
\n } else={\r\
\n :log info \"No update. Current version is \$oldfw, upgrade version is also \$newfw.\"\r\
\n }\r\
\n"

Who is online

Users browsing this forum: No registered users and 21 guests