mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Better check for SS
This commit is contained in:
parent
e061504eeb
commit
d746142626
1 changed files with 16 additions and 11 deletions
|
@ -12,22 +12,27 @@ timeout=${OMR_TRACKER_TIMEOUT:-5}
|
||||||
interval=${OMR_TRACKER_INTERVAL:-10}
|
interval=${OMR_TRACKER_INTERVAL:-10}
|
||||||
retry=${OMR_TRACKER_TRIES:-4}
|
retry=${OMR_TRACKER_TRIES:-4}
|
||||||
proxy=${OMR_TRACKER_PROXY:-127.0.0.1:1111}
|
proxy=${OMR_TRACKER_PROXY:-127.0.0.1:1111}
|
||||||
hosts=${OMR_TRACKER_HOSTS:-1.1.1.1 23.96.52.53}
|
hosts=${OMR_TRACKER_HOSTS:-1.1.1.1 1.0.0.1 23.96.52.53}
|
||||||
|
|
||||||
nodns=0
|
nodns=0
|
||||||
|
|
||||||
last=0
|
last=0
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
host=${hosts%% *}
|
while [ "$last" -gt 0 ]; do
|
||||||
if curl -s --socks5 "${proxy}" --max-time "${timeout}" --retry "${retry}" "$host" &>/dev/null ; then
|
host=${hosts%% *}
|
||||||
[ ${last} = 0 ] && log "Shadowsocks is up (can contact ${host})"
|
if curl -s --socks5 "${proxy}" --max-time "${timeout}" "$host" &>/dev/null ; then
|
||||||
/etc/init.d/shadowsocks-libev rules_up 2> /dev/null
|
[ "${last}" -gt 0 ] && log "Shadowsocks is up (can contact ${host})"
|
||||||
last=1
|
/etc/init.d/shadowsocks-libev rules_up 2> /dev/null
|
||||||
else
|
last=0
|
||||||
[ ${last} = 1 ] && log "Shadowsocks is down (can't contact ${host})"
|
else
|
||||||
/etc/init.d/shadowsocks-libev rules_down 2> /dev/null
|
last=$((last + 1 ))
|
||||||
last=0
|
[ "${last}" -ge "${retry}" ] && {
|
||||||
fi
|
log "Shadowsocks is down (can't contact ${host})"
|
||||||
|
/etc/init.d/shadowsocks-libev rules_down 2> /dev/null
|
||||||
|
last=0
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
done
|
||||||
sleep "${interval}"
|
sleep "${interval}"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue