Skip to content

Instantly share code, notes, and snippets.

@airways
Created June 30, 2017 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save airways/796ef2400406d6bf94b6e559d55550d2 to your computer and use it in GitHub Desktop.
Save airways/796ef2400406d6bf94b6e559d55550d2 to your computer and use it in GitHub Desktop.
Start pppd if ethernet connection has no network, kill it if ethernet comes up
#!/bin/sh
CONNECTION=1
while [ 1 ]
do
if ping -q -c 1 -w 1 -I eth0 google.com > /dev/null ; then
if [ $CONNECTION -eq 0 ] ; then
echo "Ethernet connection is up, killing pppd"
killall pppd
CONNECTION=1
fi
else
if [ $CONNECTION -eq 1 ] ; then
echo "No ethernet connection, dialing pppd"
pppd call gsm
CONNECTION=0
fi
fi
sleep 60
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment