How to update gravity without re-downloading block lists?

I'm running two pi-hole nodes.

I'd like that the secondary dns will pull whitelist.txt and blacklist.txt from the primary once at hour.
Then, I think, I will need to update gravity to 'merge' my lists with the remote ones.

But I'd like to avoid a redownload of remote lists. not needed and I want to respect their bandwith and server resources.

Is there a way to tell pihole to read my updated lists without redownloading the remote adlists?

You can automate this in (at least) 2 ways:

  1. You would be to create a cron entry to copy the /etc/pihole/gravity.list to your /var/www/html/admin/ folder, once a day or however many times you want/need.
    Then you can remove all blocklists from the 2-nd instance of Pi-hole and put the direct link to the 1-st instance gravity.list
    (would look something like this: http://IP.OF.FIRST.INSTANCE/admin/gravity.list)
  2. You could transfer the file via SSH (scp) form one machine to another.
    In this case you will have to issue a pihole restartdns after the list has been copied over, for the new list to be parsed and used. (You can use this method to pull the whitelist.txt and blacklist.txt too).

I'm sure there are other ways too.
I just came up with these from the top of my head :slight_smile:

1 Like

About the 1, I understand that gravity.list is already the 'mergied' and 'live' black hole, so, ok, I could rsync 'n' times a day.
Then, in all secondary dnses (plural ????) I can remove all the adlists and simply enter the url to download the gravity.list from the master.

Is it wrong to say that it's needed only the second half?

I explain (i try)... I do not need a cron copy of master gravity.list to slaves, because having gravity.list as adlist, I can change the already present cron which 1 time a week updates all lists; i simply can move it to one at hour and ... voilà ! Right or wrong?

I was just thinking to regularry rsync the files, but at this point I have the problem of how to merge files and go live without redownload all lists., but If I can do the 1.st, It could be ... fantastic.

If you are removing the block lists from all the other Pi-hole nodes (2-nd, 3-rd and so fort), you'd have to remove the

30 3   * * 7   root    PATH="$PATH:/usr/local/bin/" pihole updateGravity

line from /etc/cron.d/pihole otherwise, as the comment for that entry states, the ad sources would be updated once a week on Sunday at a random time in the early morning and that will reset the gravity.list to 0 entries.

This will work only if you place gravity.list somewhere accessible via http (hence the crontab command that will copy the file to your http enabled path on the master Pi-hole).

If you do this, you don't have to worry about moving the file via rsync.
You'd have to edit the above cron file and modify the update frequency for the secondary Pi-hole hosting devices.
Also keep in mind that this cron file is overwritten at update.

This is correct (just as instructed above). However, the gravity.list must be available via http download from the master Pi-hole in order for the secondary Pi-hole devices to be able to "download" it.

Pi-hole already handles caching the lists and checking if they need updated. Run pihole -g a few times and see that the lists are marked as cached.

We also have this flag:

pihole -g --skip-download
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.