docker-mc-backup icon indicating copy to clipboard operation
docker-mc-backup copied to clipboard

Keeping a minumum number of backups

Open jacobmichels opened this issue 3 years ago • 3 comments

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.

jacobmichels avatar Aug 24 '22 23:08 jacobmichels

That's a great point and suggestion.

itzg avatar Aug 25 '22 02:08 itzg

I agree, this option could really help :)

NirtuavLuap avatar Mar 21 '23 17:03 NirtuavLuap

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

Yanni-X avatar May 29 '23 13:05 Yanni-X