Disable gravity auto update

I have two PiHole's I am keeping synced in a master/slave configuration. Because I am using this configuration, I would like to disable the automatic gravity update on the slave device, and just let the automatic gravity update that occurs on the master device get pushed over whenever it's done. Is there a way to disable the automatic gravity update via configuration option? Or would I have to edit the cron job inside the container each time the container is created?

No.

What is getting synced - your blocklists or the combined actual domains on those lists?

If only the former, disabling gravity updates for one of your Pi-holes could mean that Pi-hole's UI would show the same list of blocklists URLs as its peer, but the blocklist contents never get's updated.

And how often does the sync happen?
If you'd be syncing domains more often than once a week, you'd consume more bandwidth than Pi-hole's weekly update, and unnecessarily so.

It's essentially a script that uses inotify to watch for write_close on specific files (gravity.db) on the primary device and then pushes them via rsync to the secondary device. So pushes only occur when the gravity.db file is done being written to.

If I were to remove every adlist from that secondary device, would that effectively prevent it from doing a Sunday morning gravity update, as it wouldn't have any lists to update from? Would it still attempt to write to gravity.db if there were no lists to update from?

Let's start from the beginning... (maybe you don't need to avoid gravity update)

  • Why do you think you need to avoid the gravity update on the second Pi-hole?
  • How are you synchronizing both pi-holes? Using a external script? I missed your post explaining the script.
  • How often do you want to run this synchronization?

Also, did you try gravity-sync?

1 Like

Thanks for the reply. I appreciate you taking the time.

  • Why do you think you need to avoid the gravity update on the second Pi-hole?

The script works in both directions, so if a whitelist entry added to one, the updated gravity.db will be immediately pulled to the other device. The paranoia I have is some concern over if the secondary device tries to write an automatically updated gravity.db while rsync is in the process of writing an updated gravity.db from the primary device, potentially leading to db corruption.

  • How often do you want to run this synchronization?

Immediately, as needed. Given that the script runs on inotify, it only syncs files that have been modified, as soon as the write_close is completed.

I looked at a few options, including this one, but ultimately decided to go for a script based on inotify so that changes could be immediately propagated, rather than periodically.

Interesting approach. :slight_smile:

But gravity.db is one of the two largest files that Pi-hole uses, and that sounds like the entire gravity database is copied to the peer even when configuring a single domain in Domains?

I wonder if your approach could be combined with @mattwebbio's Orbital-Sync, which just copies Pi-hole's teleporter file among Pi-hole sync targets.
Maybe the periodically triggered syncs can be substituted or enhanced by your inotify file monitor?