From 6e158986e4d1affbd064ed61c4869d3fb4f2f842 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 7 Jun 2024 09:04:46 +0200 Subject: [PATCH] Add a check to detect when dnsmasq not working in omr-schedule --- .../files/usr/share/omr/schedule.d/010-services | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/omr-schedule/files/usr/share/omr/schedule.d/010-services b/omr-schedule/files/usr/share/omr/schedule.d/010-services index 4ca4e88bb..72825a5f6 100755 --- a/omr-schedule/files/usr/share/omr/schedule.d/010-services +++ b/omr-schedule/files/usr/share/omr/schedule.d/010-services @@ -28,10 +28,16 @@ if [ -f /etc/init.d/glorytun-udp ] && [ "$(pgrep glorytun-udp)" = "" ] && [ "$(u sleep 5 fi -if [ "$(pgrep -f dnsmasq)" = "" ] && [ -f /etc/init.d/dnsmasq ]; then - _log "Can't find dnsmasq, restart it..." - /etc/init.d/dnsmasq restart 2>&1 >/dev/null - sleep 5 +if [ -f /etc/init.d/dnsmasq ]; then + if [ "$(pgrep -f dnsmasq)" = "" ]; then + _log "Can't find dnsmasq, restart it..." + /etc/init.d/dnsmasq restart 2>&1 >/dev/null + sleep 5 + elif [ "$(uci -q get openmptcprouter.settings.external_check)" != "0" ] && [ -n "$(dig +timeout=4 +tries=1 openmptcprouter.com | grep 'connection refused')" ]; then + _log "Can't resolve via dnsmasq, restart it..." + /etc/init.d/dnsmasq restart 2>&1 >/dev/null + sleep 5 + fi fi if [ -f /etc/init.d/unbound ] && [ "$(uci -q get unbound.@unbound[0].enabled)" = "1" ]; then if [ "$(pgrep -f unbound)" = "" ]; then