Check connection with a script

Hey, I have more than a year using Openwrt SNAPSHOT, r6305-8f24653, but I'm still being noob. I have a TP-LINK WR940Nv4 router (4 MB flash, I already can't install any other package); I have a problem with my ADSL ISP, sometimes it asings to me working IP's, and sometimes don't, so I want to create a kind of script or similar, something like this:


    every 10 minutes:
        if (ping_isn't responding):

So when I get a bad IP from my modem I have not internet until I obtain another one.

It's possible? I haven't knowledge about openwrt scripts, and I don't fully understand the openwrt documentation.

In my router I have mwan3 and watchcat installed (When I have not internet on my both wan's then my router restart itself automatically)

Thanks in advance :slight_smile: