]> 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)
committerLucas Gass <lucas@bywatersolutions.com>
Thu, 8 Feb 2024 18:56:19 +0000 (18:56 +0000)
commitc5a941f44f2e8ba8858277c2dd89e1abd4a48bef
tree3e58c3ebb652962f26a9faea04f94b0af1daceed
parentff3b281df9837a93d55ddc2e2e120826f69a07dc
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>
(cherry picked from commit cadf36dc5fbf26640efc718f4e2a3f8dd4964753)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
debian/scripts/koha-run-backups