From 608afdfb440c53387e44ceaa7bc37a8ee4a4fa50 Mon Sep 17 00:00:00 2001 From: Darkeye Date: Sat, 22 Jan 2011 23:13:06 +0100 Subject: Add test_gateway script as a cron. wan port is pinged every minute. If offline if-down-up -> retest if offline wan down diff --git a/files/etc/crontabs/root b/files/etc/crontabs/root new file mode 100644 index 0000000..cfac6b1 --- /dev/null +++ b/files/etc/crontabs/root @@ -0,0 +1 @@ +* * * * * /sbin/test_gateway > /dev/null diff --git a/files/sbin/test_gateway b/files/sbin/test_gateway new file mode 100755 index 0000000..c6742a6 --- /dev/null +++ b/files/sbin/test_gateway @@ -0,0 +1,17 @@ +#!/bin/sh +TESTHOST=4.2.2.4 +ping -c 1 -w 5 $TESTHOST &>/dev/null + +if [ $? -ne 0 ] ; then + // IP not reachable -> try if-down-up + ifdown wan + ifup wan + echo Problem we restart wan + sleep 10 + // Test Again + ping -c 1 -w 5 4.2.2.4 &>/dev/null + if [ $? -ne 0 ] ; then + echo "Mist" + ifdown wan + fi +fi -- cgit v0.10.1