1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00
This commit is contained in:
suyuan 2024-01-17 13:07:33 +08:00 committed by GitHub
commit 540732c5af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 7 deletions

View file

@ -271,7 +271,7 @@ while true; do
}
if [ -n "$OMR_TRACKER_DEVICE" ] && [ -d "/sys/class/net/$OMR_TRACKER_DEVICE" ]; then
if [ -n "$(ip link show $OMR_TRACKER_DEVICE | grep 'state UP')" ]; then
if [ -n "$(ip link show $OMR_TRACKER_DEVICE | grep 'state UP')" ] || [ -n "$(ip link show $OMR_TRACKER_DEVICE | grep 'state UNKNOWN')" ]; then
# retrieve iface ip and gateway
if ([ "$OMR_TRACKER_FAMILY" = "ipv4" ] || [ "$OMR_TRACKER_FAMILY" = "ipv4ipv6" ]) && [ "$OMR_TRACKER_INTERFACE_PROTO" != "dhcpv6" ]; then
OMR_TRACKER_DEVICE_IP=$(ip -4 -br addr ls dev "$OMR_TRACKER_DEVICE" | awk -F'[ /]+' '{print $3}')
@ -445,7 +445,7 @@ while true; do
OMR_TRACKER_HOSTS="${OMR_TRACKER_HOSTS#* } $OMR_TRACKER_HOST"
}
#OMR_TRACKER_TIMEOUT=$((OMR_TRACKER_TIMEOUT * 2))
sleep "$OMR_TRACKER_INTERVAL_TRIES"
sleep "${OMR_TRACKER_INTERVAL_TRIES:-1}"
done
fi
#if [ "$(uci -q get openmptcprouter.settings.disable_ipv6)" = "0" ] && [ -n "$OMR_TRACKER_DEVICE_IP6" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY6" ]; then
@ -550,7 +550,7 @@ while true; do
OMR_TRACKER_HOSTS6="${OMR_TRACKER_HOSTS6#* } $OMR_TRACKER_HOST6"
}
#OMR_TRACKER_TIMEOUT=$((OMR_TRACKER_TIMEOUT * 2))
sleep "$OMR_TRACKER_INTERVAL_TRIES"
sleep "${OMR_TRACKER_INTERVAL_TRIES:-1}"
done
fi
if [ -z "$OMR_TRACKER_DEVICE_IP" ] || [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ -z "$OMR_TRACKER_DEVICE_IP6" ] || [ -z "$OMR_TRACKER_DEVICE_GATEWAY6" ]; then
@ -611,8 +611,8 @@ while true; do
_restart
if [ "$OMR_TRACKER_STATUS" = "ERROR" ]; then
sleep "$OMR_TRACKER_FAILURE_INTERVAL"
sleep "${$OMR_TRACKER_FAILURE_INTERVAL:-5}"
else
sleep "$OMR_TRACKER_INTERVAL"
sleep "${OMR_TRACKER_INTERVAL:-2}"
fi
done

View file

@ -98,6 +98,7 @@ _launch_tracker() {
ifstatus=$(ifstatus "$1" | jsonfilter -q -e '@["up"]')
ifdevice=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
#[ "${ifstatus}" = "false" ] && [ -z "${ifdevice}" ] && return
[ -z "${interval}" ] && interval=2
[ -z "${interval_tries}" ] && interval_tries=1
[ -z "${count}" ] && count=2
[ -z "${max_ttl}" ] && max_ttl=60
@ -105,6 +106,7 @@ _launch_tracker() {
[ -z "${check_quality}" ] && check_quality=0
[ -z "${tries}" ] && tries=5
[ -z "${tries_up}" ] && tries_up=${tries}
[ -z "${failure_interval}" ] && failure_interval=5
procd_open_instance
# shellcheck disable=SC2086