From 1593acb77b402217b91228098c22957811b0607f Mon Sep 17 00:00:00 2001 From: Naglfar Date: Thu, 28 Apr 2022 16:07:27 +0200 Subject: [PATCH] Rename variable: LEVEL0 to LASTF --- roles/shell/files/usr/local/bin/backup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/shell/files/usr/local/bin/backup b/roles/shell/files/usr/local/bin/backup index fe7819d..3ce1e91 100644 --- a/roles/shell/files/usr/local/bin/backup +++ b/roles/shell/files/usr/local/bin/backup @@ -6,19 +6,19 @@ BACKUPS=/var/backups DUMPS=7 # Search for the last full backup. -LEVEL0=$(find $BACKUPS -name "*full.tgz" | sort | tail -n1) +LASTF=$(find $BACKUPS -name "*full.tgz" | sort | tail -n1) # Search and count incremental dumps newer than the last full backup. -INCR=$(find $BACKUPS -name "*incremental.tgz" -newer $LEVEL0 | wc -l) +INCR=$(find $BACKUPS -name "*incremental.tgz" -newer $LASTF | wc -l) # If there is at least one full backup and less than specified incremental dumps -if [ ! -z $LEVEL0 ] && [ $INCR -le $DUMPS ] +if [ ! -z $LASTF ] && [ $INCR -le $DUMPS ] then TYPE=incremental else TYPE=full rm -f $BACKUPS/*.snapshot # Remove the first backup set (full and incremental dumps) if there is a second one. - find $BACKUPS -name "*.tgz" ! -newer $LEVEL0 ! -wholename $LEVEL0 -exec rm {} \; + find $BACKUPS -name "*.tgz" ! -newer $LASTF ! -wholename $LASTF -exec rm {} \; fi nice tar -cz \