Bug 36425 - koha-run-backups deletes old backup files based on number of hours since modification - not date of modification
Summary: koha-run-backups deletes old backup files based on number of hours since modi...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 30627
Blocks:
  Show dependency treegraph
 
Reported: 2024-03-26 04:52 UTC by Alex Buckley
Modified: 2024-04-02 19:50 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Buckley 2024-03-26 04:52:08 UTC
Our Koha partner libraries are all configured to pass koha-run-backups with the --days 2 parameter. Therefore, theoretically, any old backup files modified on a date two days ago will be deleted.

However, since bug 30627 was pushed to 23.05.x and 23.11.x, we have noticed for our larger Koha instances (which run koha-run-backups for a long time each morning) the .tar.gz file from two days ago is often not deleted. 

This is because the .tar.gz file is not exactly 48+ hours old when the koha-run-backups runs the find command to identify old files to remove: https://github.com/Koha-Community/Koha/blob/286fc8e9833d55d694955849e4050d28a4b053a6/debian/scripts/koha-run-backups#L79

Often the .tar.gz file will be 47.9 hours old and therefore not deleted.

The find command should switch to checking the modification date, to ensure all files created X days ago are deleted.
Comment 1 Victor Grousset/tuxayo 2024-03-27 03:04:36 UTC
The -daystart option (from find's man) seems like a simple way to solve this by truncating the -mtime results IIUC.