EvanVanVan
Patron
- Joined
- Feb 1, 2014
- Messages
- 211
I'm looking for advice on creating some sort of script to restart Pi-Hole automatically if it's not working properly. I setup Pi-Hole in an Ubuntu VM a year ago and my router uses it as it's sole DNS server. A couple times since then I've woken up to my devices complaining "connected to network, no internet". The first time it took a while to figure out what happened, this second time was quicker lol.
For some reason (and a separate problem) whenever I try to connect to the VM with the bhyve/TrueNAS GUI, it fails to connect if it wasn't recently restarted. I end up stopping and restarting the VM from the TrueNAS GUI, and then bhyve connects properly. Of course after doing that Pi-Hole also restarts and the issue is fixed. Unfortunately, at that point I can't determine if a full VM restart was necessary or the Pi-Hole restartdns command would have been sufficient.
I found this script: https://www.reddit.com/r/pihole/comments/mctnjb/a_script_to_restart_pihole_if_it_is_down_for/ but I don't know if there is something better... That's the gist of what I'm looking for though. Check if a connection is successful, if not, restart Pi-Hole.
Thoughts?
Thank you
For some reason (and a separate problem) whenever I try to connect to the VM with the bhyve/TrueNAS GUI, it fails to connect if it wasn't recently restarted. I end up stopping and restarting the VM from the TrueNAS GUI, and then bhyve connects properly. Of course after doing that Pi-Hole also restarts and the issue is fixed. Unfortunately, at that point I can't determine if a full VM restart was necessary or the Pi-Hole restartdns command would have been sufficient.
I found this script: https://www.reddit.com/r/pihole/comments/mctnjb/a_script_to_restart_pihole_if_it_is_down_for/ but I don't know if there is something better... That's the gist of what I'm looking for though. Check if a connection is successful, if not, restart Pi-Hole.
Thoughts?
Thank you