Have you tried below to pinpoint?
You could create a watchdog script by creating below file:
sudo nano /root/pi-hole-watchdog.sh
Containing below:
#!/bin/bash
DOMAIN=pi-hole.net
[ ! $(dig +short @localhost $DOMAIN) >/dev/null 2>&1 ] && /usr/sbin/service pihole-FTL restart >/dev/null 2>&1
Make it executable:
sudo chmod u+x /root/pi-hole-watchdog.sh
Edit the crontab
for root
:
sudo crontab -e
Add below line at the bottom to schedule every minute:
* * * * * /root/pi-hole-watchdog.sh
And save/exit.
Consequences are that a considerable amount of queries will be logged in the dbase plus Pi-hole will be restarted every minute if for whatever reason the dig
command cant resolve that DOMAIN
.
EDIT: my initial attempt failed running inside cron
.
Have tested the changes I made.