Bash script that can be run on a cronjob to backup a Minecraft server.
- Linux
- Server running via Pterodactyl Panel
- Discord webhook (for notifications)
- Duplicacy installed
Generate an asymmetric key pair for encryption
openssl genrsa -aes256 -out private.pem 2048
openssl rsa -in private.pem -pubout -out public.pemCopy .env.example as .env and fill in the required secrets
cp .env.example .envInitialize the repository
./backup.sh -i /my/folder/to/backupTo update the file include/exclude filter, modify the filters file before performing your backup.
See https://github.com/gilbertchen/duplicacy/wiki/Include-Exclude-Patterns for details.
To test what will get included/excluded, perform a backup as a dry-run.
# Print everything included/excluded
./backup.sh -d
# Print only what will be excluded
./backup.sh -d | grep 'PATTERN_EXCLUDE'
# Print only what will be included
./backup.sh -d | grep 'PATTERN_INCLUDE'./backup.shTo automate this with a cronjob:
0 0 * * * cd /your/path/pcb-minecraft-backup && /bin/bash ./backup.sh
Important
The cd is required because the script assumes it is being run from the git repo directory