From e756386ff0da671b9ba77e33cd5e2f2f2b309638 Mon Sep 17 00:00:00 2001 From: Naglfar Date: Sat, 2 Oct 2021 21:18:48 +0200 Subject: [PATCH] Create a copy of the snapshot file --- roles/shell/files/usr/local/bin/backup | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/roles/shell/files/usr/local/bin/backup b/roles/shell/files/usr/local/bin/backup index 5a7e58b..385630a 100644 --- a/roles/shell/files/usr/local/bin/backup +++ b/roles/shell/files/usr/local/bin/backup @@ -13,7 +13,7 @@ then TYPE=incremental else TYPE=full - rm -f $BACKUPS/incremental.snapshot + rm -f $BACKUPS/*.snapshot fi tar -cz \ @@ -36,16 +36,17 @@ tar -cz \ /var/lib/znc/configs/ /var/lib/znc/moddata/ \ /var/spool/cron/ \ /var/spool/anacron/ \ - -g $BACKUPS/incremental.snapshot \ + -g $BACKUPS/$TYPE.snapshot \ -f $BACKUPS/$DATE-$TYPE.tgz chown root:sudo $BACKUPS/$DATE*.tgz chmod 640 $BACKUPS/*.tgz # Remove dumps and the previous backup once there is another. -if [ $TYPE = full ] && [ -e $LEVEL0 ] +if [ $TYPE = full ] then - rm $LEVEL0 $BACKUPS/*incremental.tgz + cp $BACKUPS/full.snapshot $BACKUPS/incremental.snapshot + [ -e $LEVEL0 ] && rm $LEVEL0 $BACKUPS/*incremental.tgz fi # Database backup