TheRemote/MinecraftBedrockServer

Rotate backups

pogzie opened this issue · 4 comments

Please add backup rotation feature as the backups tend to pile up after some time.

a quick option would be to cron something like

rm ls -t | awk 'NR>10'`

replacing 10 with however many you want to keep. The above will keep the 10 newest, removing the rest. Dry run by removing the rm -rf command to see what it will do. I add the above to my crontab running weekly, i bash script move the archives to a longer term storage and delete.
Edit, good lord, i cant get the ticks to stick. rm followed by backticks around the ls command is what im trying to show

Thanks. I've currently thrown all the backups to my network drive for now. Im avoiding destructive rms on the script but hopefully dev would consider this in the future to add an nBackupDays variable or something.

This is great, I need to add it to my Raspberry Pi Java Minecraft server script as well. I'll add it here for the next version!

Added in latest version