What wrong with script

:if ([/ping 8.8.8.8 count=5] = 0) 
do={
	:log info ("WatchDog connection Failed");
	/interface ppp-client disable 3g-intertelecom-1;
	:delay 5s;
	/interface ppp-client enable 3g-intertelecom-1;
		:if ([/ping 8.8.8.8 count=5] = 0) 
		do={
		/system reboot;
		}
		}
}
else={
	:log info ("WatchDog connection OK");
	}
}
}

Won’t work ((( something wrong with syntaxes here but i can’t understand exactly what is it?

:if(definition) {do={} else={}} or how ? command; or how?

try this:

:if ([/ping 8.8.8.8 count=5]=0) do={
   :log info ("WatchDog connection Failed");
   /interface ppp-client disable 3g-intertelecom-1;
   :delay 5s;
   /interface ppp-client enable 3g-intertelecom-1;
      :if ([/ping 8.8.8.8 count=5] = 0) 
      do={
      /system reboot;
      }
      }

else={
   :log info ("WatchDog connection OK");
   }

its

:if(definition) do={} else={}

or in above case

:if(definition) do={ :if(definition) do={} else={} } else={}

Seems to not working…
It not says to log ok or failed…

How to check right syntax is any debug or something like that … I can’t understand what’s wrong with it…

Logic is

Ping some address if failed disable ppp connection and with 5sec delay re-enable it…

Try again ping if still failed do router reboot…

If ping goes nothing to-do…

ROS 5.8 RB751-2nHD

I find that scripting is sensitive to the placement of do and else.
It seems best to put them on the same line as the “if” and closing “}”

:if ([/ping 8.8.8.8 count=5]=0) do={
   :log info ("WatchDog connection Failed");
   /interface ppp-client disable 3g-intertelecom-1;
   :delay 5s;
   /interface ppp-client enable 3g-intertelecom-1;
   :if ([/ping 8.8.8.8 count=5] = 0) do={
      /system reboot;
   }
} else={
   :log info ("WatchDog connection OK");
}

If you run the script from the console you can see where the error is occuring:

/system script run <your script name>

something wrong with 3 row …
Ok i understand “name_of_connetion”

now it’s working