Rename variable: LEVEL0 to LASTF

This commit is contained in:
Blade of Darkness 2022-04-28 16:07:27 +02:00
parent d1f72826e1
commit 1593acb77b
1 changed files with 4 additions and 4 deletions

View File

@ -6,19 +6,19 @@ BACKUPS=/var/backups
DUMPS=7 DUMPS=7
# Search for the last full backup. # 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. # 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 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 then
TYPE=incremental TYPE=incremental
else else
TYPE=full TYPE=full
rm -f $BACKUPS/*.snapshot rm -f $BACKUPS/*.snapshot
# Remove the first backup set (full and incremental dumps) if there is a second one. # 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 fi
nice tar -cz \ nice tar -cz \