first commit
This commit is contained in:
commit
c063a703e4
2 changed files with 27 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*~
|
26
etherswitch.sh
Executable file
26
etherswitch.sh
Executable file
|
@ -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
|
||||
|
Loading…
Reference in a new issue