]> git.koha-community.org Git - koha.git/commit
Bug 30627: Verify --days parameter and use find command to select old backups for...
authorAndreas Jonsson <andreas.jonsson@kreablo.se>
Mon, 6 Nov 2023 14:18:42 +0000 (15:18 +0100)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 31 Jan 2024 13:04:52 +0000 (14:04 +0100)
commitcadf36dc5fbf26640efc718f4e2a3f8dd4964753
tree4d5157f66524a437d12fd9c0f3c511f0eac4965b
parent884e3d5fe026c254ed1d2467f536e385ec2e7bf4
Bug 30627: Verify --days parameter and use find command to select old backups for deletion

Test plan

* Create some old fake backups:

backuproot=/var/spool/koha
instance=kohadev

backupdir="$backuproot"/"$instance"

for i in 1 2 3 4 ; do
   for j in sql tar xxx ; do
      file="$backupdir"/"$instance"-$(date -I -d "- $i day").${j}.gz
      if ! test -e "$file" ; then
         touch -t "$(date +%Y%m%d%H%M -d "- $i day")" "$file"
      fi
   done
done

* Verify that --days parameter is validated

sudo koha-run-backups --days 0
sudo koha-run-backups --days foo

* Run backup

sudo koha-run-backups --days 3

* Verify that backups from 3 days have been preserved and older backups have been deleted
* Verify that filenames that do not match the pattern (the .xxx.gz files) are preserved

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b2e5efbdae0d607f6264235ca82d884b95c1a9ef)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
debian/scripts/koha-run-backups