Created
October 18, 2025 01:58
-
-
Save rnemeth90/83a10965725cf7b207ba1ac702058f3e to your computer and use it in GitHub Desktop.
pihole backup script
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 | |
| DATE=$(date +%Y-%m-%d) | |
| BACKUP_DIR="/home/pi/pihole-backups/$DATE" | |
| mkdir -p "$BACKUP_DIR" | |
| sudo cp -r /etc/pihole "$BACKUP_DIR/" | |
| sudo cp -r /etc/dnsmasq.d "$BACKUP_DIR/" | |
| # run as cronjob | |
| # 0 2 * * * /home/pi/pihole-backup.sh >/dev/null 2>&1 | |
| # Backup File Tree | |
| # pihole-backup/ | |
| # ├── pihole/ | |
| # │ ├── setupVars.conf | |
| # │ ├── custom.list | |
| # │ └── pihole-FTL.db | |
| # ├── dnsmasq.d/ | |
| # │ ├── 100-local-lan.conf | |
| # │ └── 05-pihole-custom-cname.conf | |
| # rsync backups to network storage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment