Skip to content

Instantly share code, notes, and snippets.

@stoneobscurity
Last active October 26, 2024 20:38
Show Gist options
  • Save stoneobscurity/21261fabb5b4381d360219088210bb43 to your computer and use it in GitHub Desktop.
Save stoneobscurity/21261fabb5b4381d360219088210bb43 to your computer and use it in GitHub Desktop.
automatic backups of Pi-Hole (docker), see comments
#!/bin/bash
cd /backup && pihole -a -t
#!/bin/bash
docker exec pihole-container-name /backup/backup.sh
rsync -avrg /path/to/pihole/backup/ /path/to/backup/storage/pihole/
find /path/to/backup/storage/pihole/ -type f -name '*.tar.gz' -mtime +30 -delete
@stoneobscurity
Copy link
Author

stoneobscurity commented Apr 23, 2024

1] add a volume to the docker via run or compose.
-v /path/to/pihole/backup:/backup

2] inside that folder, add the backup.sh, besure to chmod +x.

3]now whenever you run:
docker exec pihole-container-name /backup/backup.sh

it will create a Pi-Hole teleport backup .tar.gz in /path/to/pihole/backup that you can then backup however you like.

i use a daily cron that runs the pihole.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment