From 62a3163d5bae4e806e09a143cdb75c6379b7b1b4 Mon Sep 17 00:00:00 2001 From: pezcurrel Date: Mon, 8 Jul 2024 21:14:01 +0200 Subject: [PATCH] Added code to delete all but the most recent 10 backups --- web/clitools/maintain/maintain.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/clitools/maintain/maintain.bash b/web/clitools/maintain/maintain.bash index 6ec2db8..7baf9f8 100755 --- a/web/clitools/maintain/maintain.bash +++ b/web/clitools/maintain/maintain.bash @@ -63,6 +63,8 @@ if [ "${ec}" != "0" ]; then else logcmd "xz -9 ${ofp}" "${logfp}" fi +buff=`ls -1rt maintain/backups/${dbname}_backup-*.sql.xz | head -n -10` +for fn in $buff; do rm "$fn"; done [ $ok -eq 1 ] && subj="maintain.bash: tutto ok :-)" || subj="maintain.bash: ci sono errori :-(" body="[[[ ${logfp} ]]]\n\n" body+=`cat "${logfp}"`