Configuration for auto restart/reboot on connection drops

Hi,

I have an Outdoor router, model EZR30 running on the latest OpenWrt firmware, the router provides me with a Mobile internet via the usage of a cellular network internet via the means of a simcard.

At times the cellular network connection drops due to environmental conditions, unfortunately when the connection drops, the router doesn't automatically reconnect to the network unless I restart the interface or reboot the router.

I came across the following script to act as a watchdog for the connection, but can someone please enlighten me with what does the linux code stands for, so that I can customise it to my preference but due to the fact that I'm newbie to linux I'm unable to interpret the code to human language so that I can amend it accordingly. The script code is as follows :

#!/bin/sh

tries=0
while [[ $tries -lt 10 ]]
do
    if 'ping -c 1 8.8.8.8 > /dev/null' ; then
        exit 0
    fi
    tries=$((tries+1))
done
  
ifdown MOBILE
sleep 2
sim=$(uci get network.MOBILE.sim)
date >> /root/reboot.log
timeout -t 2 uqmi -d /dev/cdc-wdm0 --set-device-operating-mode reset
sleep 30
ifup mobile

And then the script is called for on the scheduled tasks, by the syntax which follows :

*/2 * * * * /sbin/wan-watchdog.sh

One more thing, according to the syntax above, what does /2 after the first asterix do.

Thank you in advance for your help.
Rafay

Hey there, you probably found an answer by now, and thanks for sharing this script! I've been looking for something like this as well...

It boils down to pinging a host (8.8.8.8), and if that fails after ten retries, it stops the interface and brings it back up after some time...