Hello!
I have wrote a script for my routeros, but after scheduling it, it’s not running each minute as I specified in the scheduler.
The script is the next:
*:set dragonet 0
for ((j = 1; j<=10;) do=
{
i=0
for (( i = 1; i <= 10; i++ )) do=
{
:if ( [/ping 130.206.1.2 count=1 src-address 192.168.6.2] = 1 || [/ping 194.224.66.64 count=1 src-address 192.168.6.2] = 1 || [/ping 197.57.189.211 count=1 src-address 192.168.6.2] = 1 ) do=
{
:set dragonet 1
}
else=
:set dragonet 0
}
done
:if dragonet == 1) do=
{
:log info “— Dragonet FUNCIONA —”
}\
else=
{
:log info “— Dragonet NO FUNCIONA —”
}
}
done
*
I have also another script that is executing properly each 20 seconds. I know that the new script is not working properly because in the log I can’t see anything,
HELP ME PLEEASEE!!
mrz
March 7, 2008, 2:01pm
2
syntax errors.
correct ‘for’ syntax would be:
:for j from=1 to=10 do={ ... }
and if it’s version 3.x then variable ‘dragonet’ must be defined before usage.
Ok, thank you, my version is 2.9, and i did the next modifications:
:set dragonet 0
:put “Inicio”
:for j from = 1 to=10 do=
{
:set i 0
:for i from = 1 to=10 do=
{
:if ( [/ping 130.206.1.2 count=1 src-address 192.168.6.2] = 1 || [/ping 194.224.66.64 count=1 src-address 192.168.6.2] = 1 || [/ping 197.57.189.211 count=1 src-address 192.168.6.2] = 1 ) do=
{
:set dragonet 1
:put “Dragonet puesta a 1”
}
else=
:set dragonet 0
:put “Dragonet puesta a 0”
}
:if dragonet = 1) do=
{
:log info “— Dragonet FUNCIONA —”
:put “Dragonet funciona”
}\
else=
{
:log info “— Dragonet NO FUNCIONA —”
:put “Dragonet no funciona”
}
:put “fin”
}
But after the changes it doesn’t work, at all… I don’t know what to do, but Thank you very much for your answer.
mrz
March 7, 2008, 4:08pm
4
this line will give you syntax error
:if dragonet = 1) do={
correct syntax is:
:if (dragonet=1) do={
just check what you are typing before posting all your script full of typos. Or use version 3.x, at least there is syntax highlight.
Ok, you’re right, also there is an error when comparing variables i should do it with $ character before the variable name.
Sorry.
Now It’s running ok. Thank you very much!