diff options
| author | Darkeye <postfach@martinmichel.info> | 2011-01-22 22:13:06 (GMT) | 
|---|---|---|
| committer | Darkeye <postfach@martinmichel.info> | 2011-01-22 22:13:06 (GMT) | 
| commit | 608afdfb440c53387e44ceaa7bc37a8ee4a4fa50 (patch) | |
| tree | 39655a182f518b73b8199b0084d8fd589ab7029f | |
| parent | 0c93079a1185142b5e03b105c883a8741f34f89e (diff) | |
Add test_gateway script as a cron. wan port is pinged every minute. If offline if-down-up -> retest if offline wan down
| -rw-r--r-- | files/etc/crontabs/root | 1 | ||||
| -rwxr-xr-x | files/sbin/test_gateway | 17 | 
2 files changed, 18 insertions, 0 deletions
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  | 
