Created
November 4, 2011 02:02
-
-
Save almsx/1338502 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
#(c)2011 Alberto Luebbert alberto (At) ideashappy.com | |
#constant check network connectivity, on lost | |
#re-start Cards if lost are "more large" | |
#reboot the system. | |
#the script check connectivity by ping google | |
CONNECTION=1 | |
IFDOWN="/sbin/ifdown" | |
IFUP="/sbin/ifup" | |
REBOOT="/sbin/reboot" | |
PINGIP="64.233.169.103" | |
ETHS="eth0 eth1 eth2 eth3" | |
for (( ; ; )) do | |
if ping -c 1 $PINGIP > /dev/null;then | |
CONNECTION=0 | |
else | |
if [ $CONNECTION = 0 ]; then | |
CONNECTION=1 | |
for ETH in $ETHS | |
do | |
$IFDOWN $ETH | |
$IFUP $ETH | |
done | |
fi | |
if [ $CONNECTION = 1 ]; then | |
$REBOOT | |
fi | |
fi | |
sleep 45 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment