Skip to content

Instantly share code, notes, and snippets.

@rnemeth90
Created October 19, 2025 02:15
Show Gist options
  • Save rnemeth90/73d149c9ccefd8d8fe5d7aa7ded90d0c to your computer and use it in GitHub Desktop.
Save rnemeth90/73d149c9ccefd8d8fe5d7aa7ded90d0c to your computer and use it in GitHub Desktop.
sync piholes
#!/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