Here is modified script for B1300. Also not tested. Use at your own risk.

cat << "EOF" > /root/wan-watchdog.sh
#!/bin/sh

. /lib/functions/network.sh
network_flush_cache
network_find_wan NET_IF
network_get_gateway NET_GW "${NET_IF}"

TRIES=“0”
while [ "${TRIES}" -lt 5 ]
do
  if ping -w 3 "${NET_GW}" &> /dev/null
  then exit 0
  else let TRIES++
  fi
done

echo 0 > /sys/class/gpio/gpio0/value
sleep 1
echo 1 > /sys/class/gpio/gpio0/value

EOF
chmod +x /root/wan-watchdog.sh

then, add it to scheduled task (cron) and execute this every minute. You can change the number to 2 (every two minutes) etc.

cat << "EOF" >> /etc/crontabs/root

*/1 * * * * /root/wan-watchdog.sh
EOF