Created
September 21, 2017 12:37
-
-
Save WaterSibilantFalling/b031fc4ab0e87c3439ca23616d013d0a to your computer and use it in GitHub Desktop.
a little script that keeps a particular interface's internet connection up. Every minute it tests the interface and re-raises the intenet connection if the interface is down
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 | |
# test the interface every X seconds, re-up it if it is down. | |
# Completely bugged: only tests that *a* or **any** interface is up | |
PING_TRY_ADDRESS="192.168.0.1" | |
INTER_TEST_SECS=60 | |
INTERFACE=$1 | |
while (( 1 == 1)); | |
do | |
ping $PING_TRY_ADDRESS -w 1 >& /dev/null | |
rtn=$? | |
if (( $rtn != 0 )) | |
then | |
ifup $INTERFACE | |
fi | |
sleep $INTER_TEST_SECS | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment