From 39490d9487191477ff491100ed540cc5ccf0535c Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 2 Apr 2024 08:37:52 +0000 Subject: [PATCH] Bug 36435: Always delete old backup files Recently this step was moved inside the condition so would only run if koha-dump returned a success status. If a log file is being written to while koha-dump runs tar, tar returns a warning and a non-zero exit status. When this happens, koha-dump still completes but the success status condition is not true, so the old backups files are not deleted. There is no nice way to ignore the non-zero exit status from tar, and large libraries receive enough traffic for the tar 'file changed as we read it' warning to cause enough problems that old backup files begin to fill up the disk. This patch moves the step to delete old backup files outside of the koha-dump condition. This returns the script to the behaviour before it was changed in Bug 30627. Sponsored-by: Catalyst IT --- debian/scripts/koha-run-backups | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/debian/scripts/koha-run-backups b/debian/scripts/koha-run-backups index a9223844fe3..be807898e51 100755 --- a/debian/scripts/koha-run-backups +++ b/debian/scripts/koha-run-backups @@ -68,15 +68,13 @@ fi for name in $(koha-list --enabled | grep -Fxv demo) do if koha-dump ${exclude_indexes} "$name" > /dev/null; then - # Only delete old backups if dump script return success. - if [ -z "$dirname" ]; then backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' /etc/koha/sites/$name/koha-conf.xml )"; else backupdir="$dirname/$name"; fi - - find $backupdir -maxdepth 1 \( -mtime +$days -or -mtime $days \) -name $name-'[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].???'.gz \( -name \*.sql.gz -or -name \*.tar.gz \) -print0 | xargs -0 -r rm fi + + find $backupdir -maxdepth 1 \( -mtime +$days -or -mtime $days \) -name $name-'[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].???'.gz \( -name \*.sql.gz -or -name \*.tar.gz \) -print0 | xargs -0 -r rm done -- 2.30.2