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_TIMEOUT=$((OMR_TRACKER_TIMEOUT * 2))
|
||||
sleep "$OMR_TRACKER_INTERVAL_TRIES"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -11,6 +11,7 @@ config defaults 'defaults'
|
|||
option timeout '3'
|
||||
option tries '3'
|
||||
option interval '5'
|
||||
option interval_tries '1'
|
||||
option type 'ping'
|
||||
option options ''
|
||||
|
||||
|
@ -24,4 +25,5 @@ config shadowsocks 'shadowsocks'
|
|||
list hosts '80.67.169.12'
|
||||
option timeout '10'
|
||||
option tries '4'
|
||||
option interval_tries '1'
|
||||
option interval '10'
|
|
@ -11,13 +11,14 @@
|
|||
|
||||
_validate_section() {
|
||||
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" \
|
||||
'hosts:list(host)' \
|
||||
'timeout:uinteger' \
|
||||
'tries:uinteger' \
|
||||
'interval:uinteger' \
|
||||
'interval_tries:uinteger' \
|
||||
'type:string:ping' \
|
||||
'enabled:bool:1' \
|
||||
'options:string'
|
||||
|
@ -26,6 +27,7 @@ _validate_section() {
|
|||
[ -z "$timeout" ] && timeout=$tmp_timeout
|
||||
[ -z "$tries" ] && tries=$tmp_tries
|
||||
[ -z "$interval" ] && interval=$tmp_interval
|
||||
[ -z "$interval_tries" ] && interval_tries=$tmp_interval_tries
|
||||
[ -z "$options" ] && options=$tmp_options
|
||||
[ -z "$type" ] && type=$tmp_type
|
||||
[ -z "$enabled" ] && enabled=$tmp_enabled
|
||||
|
@ -36,7 +38,7 @@ _launch_tracker() {
|
|||
loopback|lan*|if0*) return;;
|
||||
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 "interface" "$1"
|
||||
|
||||
|
@ -51,6 +53,7 @@ _launch_tracker() {
|
|||
[ -z "$ifname" ] || [ -z "$multipath" ] || [ "$multipath" = "off" ] && [ "$1" != "glorytun" ] && [ "$1" != "omrvpn" ] && return
|
||||
[ "${ifenabled}" = "0" ] && return
|
||||
[ "${enabled}" = "0" ] && return
|
||||
[ -z "${interval_tries}" ] && interval_tries=1
|
||||
|
||||
procd_open_instance
|
||||
# shellcheck disable=SC2086
|
||||
|
@ -59,6 +62,7 @@ _launch_tracker() {
|
|||
procd_append_param env "OMR_TRACKER_TIMEOUT=$timeout"
|
||||
procd_append_param env "OMR_TRACKER_TRIES=$tries"
|
||||
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_DEVICE=$ifname"
|
||||
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
|
||||
EOF
|
||||
fi
|
||||
|
||||
uci -q set openmptcprouter.vps=vps
|
||||
if [ "$(uci -q omr-tracker.defaults.interval_tries)" = "" ]; then
|
||||
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