s/STATE/switch_state/g

This commit is contained in:
encrypt 2015-03-25 02:13:51 +01:00
parent e19e59cf27
commit 9f7f634933

View file

@ -1,6 +1,6 @@
#!/bin/env bash #!/bin/env bash
STATE=0 switch_state=0
function check_fn { function check_fn {
type $1 &> /dev/null || { type $1 &> /dev/null || {
@ -29,18 +29,17 @@ do
ip link show $device | grep -q "LOWER_UP" ip link show $device | grep -q "LOWER_UP"
if [ $? -eq 1 ] if [ $? -eq 1 ]
then then
if [ $STATE -eq 1 ] if [ $switch_state -eq 1 ]
then then
STATE=0 switch_state=0
on_switch_open on_switch_open
fi fi
else else
if [ $STATE -eq 0 ] if [ $switch_state -eq 0 ]
then then
STATE=1 switch_state=1
on_switch_close on_switch_close
fi fi
fi fi
sleep 0.3 sleep 0.3
done done