1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00
This commit is contained in:
suyuan 2024-08-09 21:19:25 +08:00 committed by GitHub
commit 533a1432b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 13 deletions

View file

@ -28,28 +28,29 @@ if [ -f /etc/init.d/glorytun-udp ] && [ "$(pgrep glorytun-udp)" = "" ] && [ "$(u
sleep 5
fi
if [ -f /etc/init.d/unbound ] && [ "$(uci -q get unbound.@unbound[0].enabled)" = "1" ] && [ -n "$(uci -q get dnsmasq1.server | grep 127.0.0.1#5353)" ]; then
if [ "$(pgrep -f unbound)" = "" ]; then
_log "Can't find unbound, restart it..."
/etc/init.d/unbound restart >/dev/null 2>&1
sleep 5
elif [ "$(uci -q get openmptcprouter.settings.external_check)" != "0" ] && [ "$(uci -q get unbound.ub_main.listen_port)" = "5353" ] && [ -n "$(dig +timeout=4 +tries=2 openmptcprouter.com -p 5353 | grep 'ANSWER: 0')" ]; then
_log "Can't resolve via unbound, restart it..."
/etc/init.d/unbound restart >/dev/null 2>&1
sleep 5
fi
fi
if [ -f /etc/init.d/dnsmasq ]; then
if [ "$(pgrep -f dnsmasq)" = "" ]; then
_log "Can't find dnsmasq, restart it..."
/etc/init.d/dnsmasq restart >/dev/null 2>&1
sleep 5
elif [ "$(uci -q get openmptcprouter.settings.external_check)" != "0" ] && [ -n "$(dig +timeout=4 +tries=1 openmptcprouter.com 2>&1 | grep -i 'connection refused')" ]; then
elif [ "$(uci -q get openmptcprouter.settings.external_check)" != "0" ] && [ -n "$(dig +timeout=4 +tries=2 openmptcprouter.com 2>&1 | grep -i 'connection refused')" ]; then
_log "Can't resolve via dnsmasq, restart it..."
/etc/init.d/dnsmasq restart >/dev/null 2>&1
sleep 5
fi
fi
if [ -f /etc/init.d/unbound ] && [ "$(uci -q get unbound.@unbound[0].enabled)" = "1" ]; then
if [ "$(pgrep -f unbound)" = "" ]; then
_log "Can't find unbound, restart it..."
/etc/init.d/unbound restart >/dev/null 2>&1
sleep 5
elif [ "$(uci -q get openmptcprouter.settings.external_check)" != "0" ] && [ "$(uci -q get unbound.ub_main.listen_port)" = "5353" ] && [ -n "$(dig +timeout=4 +tries=1 openmptcprouter.com -p 5353 | grep 'ANSWER: 0')" ]; then
_log "Can't resolve via unbound, restart it..."
/etc/init.d/unbound restart >/dev/null 2>&1
sleep 5
fi
fi
if [ "$(pgrep openvpn)" = "" ] && [ -f /etc/init.d/openvpn ]; then
openvpn_enable=0

View file

@ -39,7 +39,6 @@ _ping_server() {
_ping_server_intf() {
local host=$1
local valid_ip6=$(valid_subnet6 "$host")
for intf in $(multipath 2>/dev/null | awk '/default/ {print $1}'); do
local k=0
while [ "$server_ping" = false ] && [ "$k" -le "$retry" ]; do

View file

@ -236,6 +236,10 @@ if [ -z "$(grep nameserver /etc/resolv.conf)" ]; then
echo "nameserver 127.0.0.1" > /etc/resolv.conf
fi
if [ -z "$(grep unknown-server-time-limit /etc/unbound/unbound_srv.conf)" ]; then
echo "unknown-server-time-limit: 2500" > /etc/unbound/unbound_srv.conf
fi
rm -f /tmp/luci-indexcache
exit 0