commit c063a703e46bb27a4a56cab72676e63d1e223f98 Author: encrypt Date: Mon Mar 23 01:36:38 2015 +0100 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/etherswitch.sh b/etherswitch.sh new file mode 100755 index 0000000..2b8e4f8 --- /dev/null +++ b/etherswitch.sh @@ -0,0 +1,26 @@ +#!/bin/env bash + +STATE=0 + +source ~/.etherswitch + +while : +do + ip link show $interface | grep -q "LOWER_UP" + if [ $? -eq 1 ] + then + if [ $STATE -eq 1 ] + then + STATE=0 + echo "not connected" + fi + else + if [ $STATE -eq 0 ] + then + STATE=1 + echo "connected" + fi + fi + sleep 0.3 +done +