mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Fix omr-tracker really
This commit is contained in:
parent
0f24afb298
commit
6486ab9126
1 changed files with 8 additions and 6 deletions
|
@ -97,17 +97,19 @@ _dns() {
|
||||||
local deviceip=$2
|
local deviceip=$2
|
||||||
ret=$(dig @"${host}" \
|
ret=$(dig @"${host}" \
|
||||||
-b "${deviceip}" \
|
-b "${deviceip}" \
|
||||||
+time="$OTB_TRACKER_TIMEOUT" \
|
+time="$OMR_TRACKER_TIMEOUT" \
|
||||||
+tries=1 \
|
+tries=1 \
|
||||||
openmptcprouter.com
|
openmptcprouter.com
|
||||||
) && echo "$ret" | grep -sq "94.23.252.192" && {
|
) && echo "$ret" | grep -sq "94.23.252.192" && {
|
||||||
OTB_TRACKER_LATENCY=$(echo "$ret" | awk '/Query time/{print $4}')
|
OMR_TRACKER_LATENCY=$(echo "$ret" | awk '/Query time/{print $4}')
|
||||||
_update_rto "$OTB_TRACKER_LATENCY"
|
_update_rto "$OMR_TRACKER_LATENCY"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_restart
|
||||||
|
|
||||||
# main loop
|
# main loop
|
||||||
while true; do
|
while true; do
|
||||||
# setup tracker variables
|
# setup tracker variables
|
||||||
|
@ -120,14 +122,14 @@ while true; do
|
||||||
# retrieve iface ip and gateway
|
# retrieve iface ip and gateway
|
||||||
OMR_TRACKER_DEVICE_IP=$(ip -4 -br addr ls dev "$OMR_TRACKER_DEVICE" | awk -F'[ /]+' '{print $3}')
|
OMR_TRACKER_DEVICE_IP=$(ip -4 -br addr ls dev "$OMR_TRACKER_DEVICE" | awk -F'[ /]+' '{print $3}')
|
||||||
if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
||||||
OTB_TRACKER_DEVICE_GATEWAY=$(ip -4 r list dev "$OMR_TRACKER_DEVICE" | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n")
|
OMR_TRACKER_DEVICE_GATEWAY=$(ip -4 r list dev "$OMR_TRACKER_DEVICE" | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# execute specific tracker
|
# execute specific tracker
|
||||||
if [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
if [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
||||||
_ping "$OMR_TRACKER_DEVICE_GATEWAY" "$OMR_TRACKER_DEVICE_IP" "no"
|
_ping "$OMR_TRACKER_DEVICE_GATEWAY" "$OMR_TRACKER_DEVICE_IP" "no"
|
||||||
status=$?
|
status=$?
|
||||||
if ! $(exit $status); then
|
if $(exit $status); then
|
||||||
# setup loop variable
|
# setup loop variable
|
||||||
tries="$OMR_TRACKER_TRIES"
|
tries="$OMR_TRACKER_TRIES"
|
||||||
ip route replace "$OMR_TRACKER_HOST" via "$OMR_TRACKER_DEVICE_GATEWAY" dev "$OMR_TRACKER_DEVICE" src "$OMR_TRACKER_DEVICE_IP"
|
ip route replace "$OMR_TRACKER_HOST" via "$OMR_TRACKER_DEVICE_GATEWAY" dev "$OMR_TRACKER_DEVICE" src "$OMR_TRACKER_DEVICE_IP"
|
||||||
|
@ -140,7 +142,7 @@ while true; do
|
||||||
_dns "$OMR_TRACKER_HOST" "$OMR_TRACKER_DEVICE_IP" "yes"
|
_dns "$OMR_TRACKER_HOST" "$OMR_TRACKER_DEVICE_IP" "yes"
|
||||||
status=$?
|
status=$?
|
||||||
fi
|
fi
|
||||||
if ! $(exit $status); then
|
if $(exit $status); then
|
||||||
OMR_TRACKER_STATUS="OK"
|
OMR_TRACKER_STATUS="OK"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue