mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Use ping instead of dig for tracker and change default tracker ip
This commit is contained in:
parent
7f5d5735f7
commit
31cfef1e81
2 changed files with 10 additions and 10 deletions
|
@ -86,7 +86,6 @@ while true; do
|
||||||
|
|
||||||
if [ -d "/sys/class/net/$OMR_TRACKER_DEVICE" ]; then
|
if [ -d "/sys/class/net/$OMR_TRACKER_DEVICE" ]; then
|
||||||
# retrieve iface ip and gateway
|
# retrieve iface ip and gateway
|
||||||
#OMR_TRACKER_DEVICE_IP=$(ip -4 -o addr show "$OMR_TRACKER_DEVICE" | awk '{ print substr($4, 1, length($4) - 3) }')
|
|
||||||
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}')
|
||||||
|
|
||||||
# execute specific tracker
|
# execute specific tracker
|
||||||
|
@ -95,13 +94,14 @@ while true; do
|
||||||
tries="$OMR_TRACKER_TRIES"
|
tries="$OMR_TRACKER_TRIES"
|
||||||
# loop until tries attempts have been reached
|
# loop until tries attempts have been reached
|
||||||
while [ "$tries" -gt 0 ]; do
|
while [ "$tries" -gt 0 ]; do
|
||||||
ret=$(dig @"$OMR_TRACKER_HOST" \
|
ret=$(ping "$OMR_TRACKER_HOST" \
|
||||||
-b "$OMR_TRACKER_DEVICE_IP" \
|
-I "$OMR_TRACKER_DEVICE_IP" \
|
||||||
+time="$OMR_TRACKER_TIMEOUT" \
|
-w "$OMR_TRACKER_TIMEOUT" \
|
||||||
+tries=1 \
|
-c 1 \
|
||||||
|
-q \
|
||||||
"$@"
|
"$@"
|
||||||
) && echo "$ret" | grep -sq "127.6.8.4" && {
|
) && echo "$ret" | grep -sq "0% packet loss" && {
|
||||||
OMR_TRACKER_LATENCY=$(echo "$ret" | awk '/Query time/{print $4}')
|
OMR_TRACKER_LATENCY=$(echo "$ret" | cut -d "/" -s -f4 | cut -d "." -f1)
|
||||||
_update_rto "$OMR_TRACKER_LATENCY"
|
_update_rto "$OMR_TRACKER_LATENCY"
|
||||||
OMR_TRACKER_STATUS="OK"
|
OMR_TRACKER_STATUS="OK"
|
||||||
break
|
break
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
config defaults 'defaults'
|
config defaults 'defaults'
|
||||||
list hosts '51.254.49.132'
|
list hosts '4.2.2.1'
|
||||||
list hosts '51.254.49.133'
|
list hosts '8.8.8.8'
|
||||||
option timeout '1'
|
option timeout '1'
|
||||||
option tries '3'
|
option tries '4'
|
||||||
option interval '2'
|
option interval '2'
|
||||||
option options 'tracker.overthebox.ovh'
|
option options 'tracker.overthebox.ovh'
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue