docker-mc-backup
docker-mc-backup copied to clipboard
Keeping a minumum number of backups
Is there any way of keeping a minimum number of backups safe from being pruned? I'm worried about setting PRUNE_BACKUPS_DAYS and PAUSE_IF_NO_PLAYERS=true at the same time, because, if my understanding is correct, if the server goes PRUNE_BACKUPS_DAYS days without any players then all backups would get deleted.
Maybe adding a new option like MIN_BACKUPS could be a solution to this.
That's a great point and suggestion.
I agree, this option could really help :)
Maybe not useful for development of this feature, but in the meantime you can use a CRON job to at least copy the latest backup with a .backup file ending so that it doesn't get pruned. Mine looks like that, you probably need to adapt the directory.
0 1 * * * cp -p "/home/docker/mc-backups/`ls -t1 /home/docker/mc-backups| head -n 1`" /home/docker/mc-backups/latest.tgz.backup
it copies the latest backup, and if latest.tgz.backup is the latest one, it doesn't do anything. And the prune-script will not prune it because it only looks for *.tgz