Reboot router GL-AR300M if no internet


#1

Hi,
sometimes my router GL-AR300M with internet usb key, lose the internet connection. The solution is to restart the router. I don’t know why, may be the internet usb key is the problem.

But I need to solve the problem. I write this bash file:

#!/bin/bash
if ping -c 4 -W 1 10.8.0.1 >/dev/null; then
echo “IPv4 is up”
else
echo “IPv4 is down”
reboot -d 60
fi

10.8.0.1 is the vpn server. If no ping then restart

With cron I write: 0 * * * * sh /etc/crontabs/restart.sh>>restart.log

I don’t know if the cron file si correct. Every hour it ceck the connection.
But I don’t see the restart log, so I’m afraid that it does not work.
Can someone help me?
Best regards


#2

I solved, thank you!
BR


#3

Why reboot? In fact, you can use restart network instead.