Automatic Gravity Update?

Hi, I log in to my Pi-Hole device once in a while and I manually click “Update Gravity (list of blocked domains“ to refresh the list which is hosted at https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts.

I am curious if this process can be automated; i.e. have the Pi-Hole device refresh the list every day.

Thanks

Pi-hole automatically updates its gravity database on Sundays (at a random time) by default.

If you type the following command, you will see the cron set up by Pi-hole to update gravity. Each install has a randomly assigned time on Sunday morning between 0300 and 0500 local.

cat /etc/cron.d/pihole

In my install, the cron line looks like this:

49 3 * * 7 root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole/pihole_updateGravity.log || cat /var/log/pihole/pihole_updateGravity.log

That is on day 7 (Sunday) at 0349.

If you then look at the timestamp on that log file, you will see when the update was last run:

ls -lha /var/log/pihole

There is little value in updating gravity every day. Not a lot of domains change in a day in any given list, so weekly is more than adequate.

1 Like

Thank you so much to both of you! I was not aware of this feature.