Created
October 19, 2025 02:15
-
-
Save rnemeth90/73d149c9ccefd8d8fe5d7aa7ded90d0c to your computer and use it in GitHub Desktop.
sync piholes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # setup remote access first | |
| ## ssh-keygen -t ed25519 -C "pihole sync key" | |
| ## ssh-copy-id [email protected] | |
| # Pi-hole sync with rsync | |
| DEST_HOST="[email protected]" | |
| # Sync pihole config | |
| rsync -avz --delete /etc/pihole/ $DEST_HOST:/etc/pihole/ | |
| # Sync dnsmasq config | |
| rsync -avz --delete /etc/dnsmasq.d/ $DEST_HOST:/etc/dnsmasq.d/ | |
| # Restart Pi-hole DNS on remote | |
| ssh $DEST_HOST 'sudo pihole restartdns' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment