mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2024-12-23 12:43:35 +00:00
fix gateway supervisor function for usb direct monitoring
This commit is contained in:
parent
9212bd641d
commit
16c89dca72
@ -59,22 +59,25 @@ wait_for_icamera() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gateway_supervisor() {
|
gateway_supervisor() {
|
||||||
count=0
|
last=0
|
||||||
while [ true ]; do
|
last2=0
|
||||||
if ! ping -c1 -W 2 `/opt/wz_mini/bin/busybox ip route | awk '/default/ { print $3 }'` >& /dev/null; then
|
|
||||||
echo "$1: Unable to reach default route via USB Direct Link, ifdown usb0..."
|
while [[ 1 ]]; do
|
||||||
count=0
|
ping -c1 -W 2 `/opt/wz_mini/bin/busybox ip route | awk '/default/ { print $3 }'` >& /dev/null
|
||||||
|
status=$?
|
||||||
|
if [[ $status == 1 ]]; then
|
||||||
|
echo "$1: $(date) Unable to reach default route via USB Direct Link..."
|
||||||
|
if [[ $last == 1 && $last2 == 1 ]]; then
|
||||||
|
echo "$1: $(date) USB Direct is Down, bring down usb0"
|
||||||
ifconfig usb0 down
|
ifconfig usb0 down
|
||||||
|
status=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
last2=$last
|
||||||
|
last=$status
|
||||||
|
|
||||||
sleep 10
|
sleep 10
|
||||||
else
|
|
||||||
if [[ $count -ne 1 ]]
|
|
||||||
then
|
|
||||||
#echo "Connected."
|
|
||||||
count=1
|
|
||||||
sleep 5
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user