From e1b86c3118b9466f63fccc0245d7075181a3fafd Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Wed, 13 Dec 2023 10:55:30 +0100 Subject: [PATCH] Check if unbound is working, else restart it --- .../usr/share/omr/post-tracking.d/010-services | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mptcp/files/usr/share/omr/post-tracking.d/010-services b/mptcp/files/usr/share/omr/post-tracking.d/010-services index 4cc11015b..7f2368b74 100755 --- a/mptcp/files/usr/share/omr/post-tracking.d/010-services +++ b/mptcp/files/usr/share/omr/post-tracking.d/010-services @@ -33,10 +33,16 @@ if [ "$(pgrep -f dnsmasq)" = "" ] && [ -f /etc/init.d/dnsmasq ]; then /etc/init.d/dnsmasq restart 2>&1 >/dev/null sleep 5 fi -if [ "$(pgrep -f unbound)" = "" ] && [ -f /etc/init.d/unbound ] && [ "$(uci -q get unbound.@unbound[0].enabled)" = "1" ]; then - _log "Can't find unbound, restart it..." - /etc/init.d/unbound restart 2>&1 >/dev/null - sleep 5 +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 2>&1 >/dev/null + 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 2>&1 >/dev/null + sleep 5 + fi fi if [ "$(pgrep openvpn)" = "" ] && [ -f /etc/init.d/openvpn ]; then