Change snapshot mode, owner and group. Preserve attributes on copy

This commit is contained in:
Naglfar 2021-10-04 11:53:24 +02:00
parent ac8bcf8046
commit 3d83b32edd
1 changed files with 3 additions and 3 deletions

View File

@ -39,12 +39,12 @@ tar -cz \
-g $BACKUPS/$TYPE.snapshot \ -g $BACKUPS/$TYPE.snapshot \
-f $BACKUPS/$DATE-$TYPE.tgz -f $BACKUPS/$DATE-$TYPE.tgz
chown root:sudo $BACKUPS/$DATE*.tgz chown root:sudo $BACKUPS/{$DATE*.tgz,$TYPE.snapshot}
chmod 640 $BACKUPS/*.tgz chmod 640 $BACKUPS/{*.tgz,$TYPE.snapshot}
if [ $TYPE = full ] if [ $TYPE = full ]
then then
cp $BACKUPS/full.snapshot $BACKUPS/incremental.snapshot cp -p $BACKUPS/full.snapshot $BACKUPS/incremental.snapshot
# Remove dumps and the previous backup if there is another one. # Remove dumps and the previous backup if there is another one.
[ -e $LEVEL0 ] && rm $LEVEL0 $BACKUPS/*incremental.tgz [ -e $LEVEL0 ] && rm $LEVEL0 $BACKUPS/*incremental.tgz
fi fi