palworld-server-docker icon indicating copy to clipboard operation
palworld-server-docker copied to clipboard

Changed backup so only old backup files are deleted

Open Dashboy1998 opened this issue 1 year ago • 0 comments

Context

  • Currently anything older than OLD_BACKUP_DAYS in the backup folder is deleted including directories or non backup files
  • Changes here ensure only only backup files are deleted

Choices

  • Added additional flag to delete only files
  • Added additional flag so only backups which have not had the names modified are deleted

Test instructions

  1. Start container with DELETE_OLD_BACKUPS=true
  2. Enter container: docker exec -it palworld-server bash
  3. Create at least 4 backups
  4. Go to the backup folder: cd /palworld/backups
  5. Change of the modified date the backups: find /palworld/backups/ -exec touch -d "9001 days ago" {} \;
  6. Create 2 directories: mkdir keep empty
  7. Move a backup to keep: mv palworld-save-2024-01-.... keep/
  8. Rename one backup: mv palworld-save-2024-01-.... important_palworld-save-2024-01-....
  9. Run backup
  10. Verify that empty and keep directories still exists
  11. Verify the backup in keep still exists
  12. Verify that the backup which you renamed still exists

Checklist before requesting a review

  • [x] I have performed a self-review of my code
  • [x] I've added documentation about this change to the README.
  • [x] I've not introduced breaking changes.

Dashboy1998 avatar Jan 30 '24 02:01 Dashboy1998