1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Fix Shadowsocks status test

This commit is contained in:
Ycarus 2018-06-06 13:25:32 +02:00
parent 77a7644ad2
commit 7e851fc9b7
3 changed files with 14 additions and 17 deletions

View file

@ -19,20 +19,17 @@ nodns=0
last=0
while true; do
while [ "$last" -gt 0 ]; do
host=${hosts%% *}
if curl -s --socks5 "${proxy}" --max-time "${timeout}" "$host" &>/dev/null ; then
[ "${last}" -gt 0 ] && log "Shadowsocks is up (can contact ${host})"
/etc/init.d/shadowsocks-libev rules_up 2> /dev/null
last=0
else
last=$((last + 1 ))
[ "${last}" -ge "${retry}" ] && {
log "Shadowsocks is down (can't contact ${host})"
/etc/init.d/shadowsocks-libev rules_down 2> /dev/null
last=0
}
fi
done
host=${hosts%% *}
if curl -s --socks5 "${proxy}" --max-time "${timeout}" "$host" &>/dev/null ; then
[ "${last}" -gt 0 ] && log "Shadowsocks is up (can contact ${host})"
/etc/init.d/shadowsocks-libev rules_up 2> /dev/null
last=0
else
last=$((last + 1 ))
[ "${last}" -eq "${retry}" ] && {
log "Shadowsocks is down (can't contact ${host})"
/etc/init.d/shadowsocks-libev rules_down 2> /dev/null
}
fi
sleep "${interval}"
done