A Feature Required to Restart DNS Resolver After a Period of Time Automatically

The feature to restart the DNS resolver automatically is need as the various links in the block-lists gets updated on a daily basis and to update the list the DNS resolver needs to be restarted after a specific time. Now the users have to manually restart the resolver in order to do the same. It would be great if there was a feature that the block-lists in the pi-hole can be updated automatically.

This is not the case. Restarting the resolver does not rebuild gravity from your subscribed lists.

You can manually update gravity at any time from either the web admin GUI > Tools > Update Gravity, or from the command line with the command pihole -g

This feature exists. There is a cron script installed by Pi-hole that updates gravity weekly on Sunday morning at a randomly selected time between 3 am and 5 am your local time. Each Pi-hole install has the time fixed on that install, but the time is randomly assigned so all the Pi-holes in the world don't hit the blocklist servers at once. Your time is shown in your debug log output, and will look similar to this - in this example the script is set to run at 0434 local time.

-rw-r--r-- 1 root root 1704 May  1 20:24 /etc/cron.d/pihole
   43 4   * * 7   root    PATH="$PATH:/usr/local/bin/" pihole updateGravity >/var/log/pihole_updateGravity.log || cat /var/log/pihole_updateGravity.log
1 Like

How can i edit the time ?? Because my internet is not 24/7 turned on

You can manually edit this file and change the parameters. Note that your local changes will be overwritten on a Pi-hole update or repair.

sudo nano /etc/cron.d/pihole

As noted in that file, there are other locations where you can place cron scripts that will not be overwritten by Pi-hole.

https://www.raspberrypi.org/documentation/linux/usage/cron.md

if i put the time only and put * on the 7 does that mean it will update all 7 days

?

2 Likes
1 Like