2019-10-29 23:17:56 +01:00
# synchole
2019-11-07 23:02:34 +01:00
Shell script to syncronize two or more [pi-hole ](https://pi-hole.net ) servers. It replicates all changes to _blacklist.txt_ , _whitelist.txt_ , _regex.list_ , _/etc/hosts_ and runs `updateGravity` /`restartdns` on all members.
## Setup
1. Login via SSH to the `MASTER` server.
2019-11-08 23:15:01 +01:00
2019-11-07 23:02:34 +01:00
2. Create symlinks for all files you want to sync within the webroot of the `MASTER` pihole.
```
cd /var/www/html
sudo mkdir synchole
cd synchole
sudo ln -s /etc/pihole/whitelist.txt .
sudo ln -s /etc/pihole/blacklist.txt .
sudo ln -s /etc/pihole/regex.list .
```
2019-11-08 23:15:01 +01:00
2019-11-07 23:02:34 +01:00
3. Login via SSH to the `SLAVE` server.
2019-11-08 23:15:01 +01:00
2019-11-07 23:02:34 +01:00
4. Install synchole on the `SLAVE` server.
```
cd /opt
sudo git clone https://socialg.it/david/synchole.git
```
2019-11-08 23:15:01 +01:00
2019-11-07 23:02:34 +01:00
5. Configure the synchole script.
```
sudo vim /opt/synchole.sh
```
The config section is at the top of the script.
2019-11-08 23:15:01 +01:00
2019-11-07 23:02:34 +01:00
6. Create a cron job for synchole on the `SLAVE` server.
```
sudo crontab -e
```
Example cronjob: `*/5 * * * * /opt/synchole/synchole.sh -q` (this runs the synchole every 5 minutes)
2019-11-08 23:15:01 +01:00
2019-11-07 23:02:34 +01:00
7. Setup postfix to send notifications (from cron) on the `SLAVE` server.
```
< placeholder >
```
2019-11-08 23:15:01 +01:00
8. Repeat steps 3 through 7 for additional `SLAVE` servers.
2019-11-07 23:02:34 +01:00
9. Happy syncholeing!
## Resources
- https://discourse.pi-hole.net/t/what-files-does-pi-hole-use/1684