added example-backup.sh

This commit is contained in:
2026-04-13 19:20:17 -07:00
parent 19e9227d6f
commit fdd3ce9b5d

15
example-backup.sh Normal file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
# Best used in a cron job:
# crontab -e
# 00 01 * * * /path/to/backup.sh
BASE_PATH=/path/to/simple-minecraft-server # Change this to the path which your docker-compose.yml is in. Remove the trailing /.
SOURCE=$BASE_PATH/data # If you are using the docker-compose.yml provided in this repo then all of the data that you will want to backup is stored in ./data
DESTINATION=$BASE_PATH/backups # set this to the location of where you want to back your minecraft server data up to.
KEEP_MAX_AGE=6D # this default will delete backups older than 6 days.
###########################
# DO NOT EDIT THESE LINES #
###########################
rdiff-backup $SOURCE $DESTINATION/$(date +%A)
rdiff-backup --force --remove-older-than $KEEP_MAX_AGE $DESTINATION/$(date +%A)