1
0
Fork 0
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:
Ycarus (Yannick Chabanois) 2020-01-07 18:05:00 +01:00
parent 200d7101a5
commit 244b8f421c
2 changed files with 4 additions and 3 deletions

View file

@ -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
nocontact=""
[ "${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 commit openmptcprouter.omr
}
@ -75,7 +75,7 @@ while true; do
[ -z "$nocontact" ] && nocontact="$host" || nocontact="$nocontact, $host"
[ "${last}" -ge "${retry}" ] && {
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 commit openmptcprouter.omr
/etc/init.d/shadowsocks-libev rules_down 2> /dev/null

View file

@ -56,6 +56,7 @@ _launch_tracker() {
[ -z "$ifname" ] || [ -z "$multipath" ] || [ "$multipath" = "off" ] && [ "$1" != "glorytun" ] && [ "$1" != "omrvpn" ] && return
[ "${ifenabled}" = "0" ] && return
[ "${enabled}" = "0" ] && return
[ -z "${hosts}" ] && return
[ -z "${interval_tries}" ] && interval_tries=1
procd_open_instance
@ -121,7 +122,7 @@ _launch_shadowsocks_tracker() {
local disabled
config_get disabled "$1" disabled 0
[ "$enabled" = "0" ] || [ "$disabled" = "1" ] && return
[ "$enabled" = "0" ] || [ "$disabled" = "1" ] || [ -z "$hosts" ] && return
procd_open_instance
# shellcheck disable=SC2086