mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Disable omr-tracker if no hosts defined
This commit is contained in:
parent
200d7101a5
commit
244b8f421c
2 changed files with 4 additions and 3 deletions
|
@ -59,7 +59,7 @@ while true; do
|
||||||
if [ "$(curl -s -I -w %{http_code} --socks5 ${proxy} --max-time ${timeout} $host -o /dev/null)" != "000" ]; then
|
if [ "$(curl -s -I -w %{http_code} --socks5 ${proxy} --max-time ${timeout} $host -o /dev/null)" != "000" ]; then
|
||||||
nocontact=""
|
nocontact=""
|
||||||
[ "${last}" -ge "${retry}" ] || [ "$(uci -q get openmptcprouter.omr.shadowsocks)" = "" ] && {
|
[ "${last}" -ge "${retry}" ] || [ "$(uci -q get openmptcprouter.omr.shadowsocks)" = "" ] && {
|
||||||
_log "Shadowsocks is up (can contact ${host})"
|
_log "Shadowsocks is up (can contact via http ${host})"
|
||||||
uci -q set openmptcprouter.omr.shadowsocks="up"
|
uci -q set openmptcprouter.omr.shadowsocks="up"
|
||||||
uci -q commit openmptcprouter.omr
|
uci -q commit openmptcprouter.omr
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ while true; do
|
||||||
[ -z "$nocontact" ] && nocontact="$host" || nocontact="$nocontact, $host"
|
[ -z "$nocontact" ] && nocontact="$host" || nocontact="$nocontact, $host"
|
||||||
[ "${last}" -ge "${retry}" ] && {
|
[ "${last}" -ge "${retry}" ] && {
|
||||||
if [ -n "$(iptables -t nat -L -n | grep ss_rules_forward)" ]; then
|
if [ -n "$(iptables -t nat -L -n | grep ss_rules_forward)" ]; then
|
||||||
_log "Shadowsocks is down (can't contact ${nocontact})"
|
_log "Shadowsocks is down (can't contact via http ${nocontact})"
|
||||||
uci -q set openmptcprouter.omr.shadowsocks="down"
|
uci -q set openmptcprouter.omr.shadowsocks="down"
|
||||||
uci -q commit openmptcprouter.omr
|
uci -q commit openmptcprouter.omr
|
||||||
/etc/init.d/shadowsocks-libev rules_down 2> /dev/null
|
/etc/init.d/shadowsocks-libev rules_down 2> /dev/null
|
||||||
|
|
|
@ -56,6 +56,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 "${hosts}" ] && return
|
||||||
[ -z "${interval_tries}" ] && interval_tries=1
|
[ -z "${interval_tries}" ] && interval_tries=1
|
||||||
|
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
|
@ -121,7 +122,7 @@ _launch_shadowsocks_tracker() {
|
||||||
local disabled
|
local disabled
|
||||||
config_get disabled "$1" disabled 0
|
config_get disabled "$1" disabled 0
|
||||||
|
|
||||||
[ "$enabled" = "0" ] || [ "$disabled" = "1" ] && return
|
[ "$enabled" = "0" ] || [ "$disabled" = "1" ] || [ -z "$hosts" ] && return
|
||||||
|
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue