Community discussions

MikroTik App
 
User avatar
sky
newbie
Topic Author
Posts: 28
Joined: Sun Nov 05, 2006 8:49 pm
Location: EST

Problem with :local

Mon Aug 25, 2008 2:26 pm

hi!
trying to customize auto-update script from Wiki.

The part of the script:
:if ([$myVer] != $lVer) do={
:local pckgName "routeros-" . $platform . "-" . $lMajor . "." . $lMinor . ".npk";
/tool fetch ...
An error occurs, when i'm trinyng to run script:
expected variable name (line 31 column 6)
line 31 is :local pckgName "routeros-" . $platform . "-" . $lMajor . "." . $lMinor . ".npk";
Don't understand, why this error occurs. :?
Anybody can help?

PS ROS 3.11 on RB133
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 6077
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Problem with :local

Mon Aug 25, 2008 3:04 pm

Make sure $platform $lMajor $lMinor variables are defined.
 
User avatar
sky
newbie
Topic Author
Posts: 28
Joined: Sun Nov 05, 2006 8:49 pm
Location: EST

Re: Problem with :local

Mon Aug 25, 2008 4:14 pm

that's ok
:local lMajor
:local lMinor
:local vMajor
:local vMinor
:local platform [/system resource get architecture-name]
 
User avatar
sky
newbie
Topic Author
Posts: 28
Joined: Sun Nov 05, 2006 8:49 pm
Location: EST

Re: Problem with :local

Thu Aug 28, 2008 10:21 am

here is the full list of code, maybe somebody can help me on this...
:local lMajor
:local lMinor
:local vMajor
:local vMinor
:local ftpserver "10.10.10.221"
:local ftppass ""
:local ftpuser "admin"
:local platform [/system resource get architecture-name]
:local myVer [/system resource get version]

/tool fetch address="" src-path="CurrentVersion.txt" user="$ftpuser" password="$ftppass" mode=ftp;

:local lVer [/file get CurrentVersion.txt content]

:for i from=0 to=([:len $myVer] - 1) do={
:if ( [:pick $myVer $i] = ".") do={
:set vMajor [:tonum [:pick $myVer 0 $i]];
:set vMinor [:tonum [:pick $myVer ($i + 1) [:len $myVer]]]
}
}

:delay 5s;
:for i from=0 to=([:len $lVer] - 1) do={
:if ( [:pick $lVer $i] = ".") do={
:set lMajor [:tonum [:pick $lVer 0 $i]];
:set lMinor [:tonum [:pick $lVer ($i + 1) [:len $lVer]]]
}
}

:if ([$myVer] != $lVer) do={
:local pckgName "routeros-" . $platform . "-" . $lMajor . "." . $lMinor . ".npk";
/tool fetch address="$ftpserver" user="$ftpuser" password="$ftppass" mode=ftp src-path="$pckgName";
/system reboot;
}
 
User avatar
sky
newbie
Topic Author
Posts: 28
Joined: Sun Nov 05, 2006 8:49 pm
Location: EST

Re: Problem with :local

Thu Aug 28, 2008 10:38 am

solution was found...
should be
:local pckgName ("routeros-" . $platform . "-" . $lMajor . "." . $lMinor . ".npk");
But another error occurs:
[admin@Update1] /system script> run 0
interrupted
bad name
And there is no line number.. how can i know where this problem occurs?

Who is online

Users browsing this forum: Bing [Bot] and 20 guests