mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Set interval between retry
This commit is contained in:
parent
5a1f6d0957
commit
3a1f078e87
4 changed files with 15 additions and 4 deletions
|
@ -217,6 +217,7 @@ while true; do
|
||||||
OMR_TRACKER_HOSTS="${OMR_TRACKER_HOSTS#* } $OMR_TRACKER_HOST"
|
OMR_TRACKER_HOSTS="${OMR_TRACKER_HOSTS#* } $OMR_TRACKER_HOST"
|
||||||
}
|
}
|
||||||
OMR_TRACKER_TIMEOUT=$((OMR_TRACKER_TIMEOUT * 2))
|
OMR_TRACKER_TIMEOUT=$((OMR_TRACKER_TIMEOUT * 2))
|
||||||
|
sleep "$OMR_TRACKER_INTERVAL_TRIES"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -11,6 +11,7 @@ config defaults 'defaults'
|
||||||
option timeout '3'
|
option timeout '3'
|
||||||
option tries '3'
|
option tries '3'
|
||||||
option interval '5'
|
option interval '5'
|
||||||
|
option interval_tries '1'
|
||||||
option type 'ping'
|
option type 'ping'
|
||||||
option options ''
|
option options ''
|
||||||
|
|
||||||
|
@ -24,4 +25,5 @@ config shadowsocks 'shadowsocks'
|
||||||
list hosts '80.67.169.12'
|
list hosts '80.67.169.12'
|
||||||
option timeout '10'
|
option timeout '10'
|
||||||
option tries '4'
|
option tries '4'
|
||||||
|
option interval_tries '1'
|
||||||
option interval '10'
|
option interval '10'
|
|
@ -11,13 +11,14 @@
|
||||||
|
|
||||||
_validate_section() {
|
_validate_section() {
|
||||||
local tmp_hosts=$hosts tmp_timeout=$timeout tmp_tries=$tries
|
local tmp_hosts=$hosts tmp_timeout=$timeout tmp_tries=$tries
|
||||||
local tmp_interval=$interval tmp_options=$options tmp_type=$type tmp_enabled=$enabled
|
local tmp_interval=$interval tmp_interval_tries=$interval_tries tmp_options=$options tmp_type=$type tmp_enabled=$enabled
|
||||||
|
|
||||||
uci_validate_section omr-tracker "$1" "$2" \
|
uci_validate_section omr-tracker "$1" "$2" \
|
||||||
'hosts:list(host)' \
|
'hosts:list(host)' \
|
||||||
'timeout:uinteger' \
|
'timeout:uinteger' \
|
||||||
'tries:uinteger' \
|
'tries:uinteger' \
|
||||||
'interval:uinteger' \
|
'interval:uinteger' \
|
||||||
|
'interval_tries:uinteger' \
|
||||||
'type:string:ping' \
|
'type:string:ping' \
|
||||||
'enabled:bool:1' \
|
'enabled:bool:1' \
|
||||||
'options:string'
|
'options:string'
|
||||||
|
@ -26,6 +27,7 @@ _validate_section() {
|
||||||
[ -z "$timeout" ] && timeout=$tmp_timeout
|
[ -z "$timeout" ] && timeout=$tmp_timeout
|
||||||
[ -z "$tries" ] && tries=$tmp_tries
|
[ -z "$tries" ] && tries=$tmp_tries
|
||||||
[ -z "$interval" ] && interval=$tmp_interval
|
[ -z "$interval" ] && interval=$tmp_interval
|
||||||
|
[ -z "$interval_tries" ] && interval_tries=$tmp_interval_tries
|
||||||
[ -z "$options" ] && options=$tmp_options
|
[ -z "$options" ] && options=$tmp_options
|
||||||
[ -z "$type" ] && type=$tmp_type
|
[ -z "$type" ] && type=$tmp_type
|
||||||
[ -z "$enabled" ] && enabled=$tmp_enabled
|
[ -z "$enabled" ] && enabled=$tmp_enabled
|
||||||
|
@ -36,7 +38,7 @@ _launch_tracker() {
|
||||||
loopback|lan*|if0*) return;;
|
loopback|lan*|if0*) return;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
local hosts timeout tries interval options type enabled
|
local hosts timeout tries interval interval_tries options type enabled
|
||||||
_validate_section "defaults" "defaults"
|
_validate_section "defaults" "defaults"
|
||||||
_validate_section "interface" "$1"
|
_validate_section "interface" "$1"
|
||||||
|
|
||||||
|
@ -51,6 +53,7 @@ _launch_tracker() {
|
||||||
[ -z "$ifname" ] || [ -z "$multipath" ] || [ "$multipath" = "off" ] && [ "$1" != "glorytun" ] && [ "$1" != "omrvpn" ] && return
|
[ -z "$ifname" ] || [ -z "$multipath" ] || [ "$multipath" = "off" ] && [ "$1" != "glorytun" ] && [ "$1" != "omrvpn" ] && return
|
||||||
[ "${ifenabled}" = "0" ] && return
|
[ "${ifenabled}" = "0" ] && return
|
||||||
[ "${enabled}" = "0" ] && return
|
[ "${enabled}" = "0" ] && return
|
||||||
|
[ -z "${interval_tries}" ] && interval_tries=1
|
||||||
|
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
|
@ -59,6 +62,7 @@ _launch_tracker() {
|
||||||
procd_append_param env "OMR_TRACKER_TIMEOUT=$timeout"
|
procd_append_param env "OMR_TRACKER_TIMEOUT=$timeout"
|
||||||
procd_append_param env "OMR_TRACKER_TRIES=$tries"
|
procd_append_param env "OMR_TRACKER_TRIES=$tries"
|
||||||
procd_append_param env "OMR_TRACKER_INTERVAL=$interval"
|
procd_append_param env "OMR_TRACKER_INTERVAL=$interval"
|
||||||
|
procd_append_param env "OMR_TRACKER_INTERVAL_TRIES=$interval_tries"
|
||||||
procd_append_param env "OMR_TRACKER_TABLE=$ip4table"
|
procd_append_param env "OMR_TRACKER_TABLE=$ip4table"
|
||||||
procd_append_param env "OMR_TRACKER_DEVICE=$ifname"
|
procd_append_param env "OMR_TRACKER_DEVICE=$ifname"
|
||||||
procd_append_param env "OMR_TRACKER_DEVICE_GATEWAY=$gateway"
|
procd_append_param env "OMR_TRACKER_DEVICE_GATEWAY=$gateway"
|
||||||
|
|
|
@ -17,5 +17,9 @@ if [ "$(uci -q ucitrack.@shadowsocks-libev[-1].affects | grep omr-tracker)" = ""
|
||||||
commit ucitrack
|
commit ucitrack
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
if [ "$(uci -q omr-tracker.defaults.interval_tries)" = "" ]; then
|
||||||
uci -q set openmptcprouter.vps=vps
|
uci -q batch <<-EOF
|
||||||
|
set omr-tracker.defaults.interval_tries=1
|
||||||
|
commit omr-tracker
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue