|
@@ -0,0 +1,31 @@
|
|
|
+#!/bin/bash
|
|
|
+
|
|
|
+FLAG = /etc/no-smart-reboot
|
|
|
+IP = 89.234.141.73
|
|
|
+
|
|
|
+function fix_by_rebooting () {
|
|
|
+ touch $FLAG
|
|
|
+ # Update time at boot
|
|
|
+ touch /etc/banner
|
|
|
+ reboot
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+# See here to understand why this sleep 70
|
|
|
+# https://openwrt.org/docs/guide-user/base-system/cron#periodic_reboot_of_a_router
|
|
|
+sleep 70
|
|
|
+if [ -e $FLAG ]; then
|
|
|
+ if ping -c10 -i3 -q $IP > /dev/null ; then
|
|
|
+ rm -f $FLAG
|
|
|
+ elif [ "$(date +%M)" = "42" ]; then
|
|
|
+ fix_by_rebooting
|
|
|
+ elif [ "$(date +%M)" = "12" ]; then
|
|
|
+ fix_by_rebooting
|
|
|
+ fi
|
|
|
+else
|
|
|
+ if ! ping -c2 -q $IP > /dev/null ; then
|
|
|
+ fix_by_rebooting
|
|
|
+ elif [ "$(date +%H%M)" = "0430" ]; then
|
|
|
+ fix_by_rebooting
|
|
|
+ fi
|
|
|
+fi
|