From 3d83b32edd34955611f9c0e4e2815254258bfdf8 Mon Sep 17 00:00:00 2001 From: Naglfar Date: Mon, 4 Oct 2021 11:53:24 +0200 Subject: [PATCH] Change snapshot mode, owner and group. Preserve attributes on copy --- roles/shell/files/usr/local/bin/backup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/shell/files/usr/local/bin/backup b/roles/shell/files/usr/local/bin/backup index 58d3271..2ecb463 100644 --- a/roles/shell/files/usr/local/bin/backup +++ b/roles/shell/files/usr/local/bin/backup @@ -39,12 +39,12 @@ tar -cz \ -g $BACKUPS/$TYPE.snapshot \ -f $BACKUPS/$DATE-$TYPE.tgz -chown root:sudo $BACKUPS/$DATE*.tgz -chmod 640 $BACKUPS/*.tgz +chown root:sudo $BACKUPS/{$DATE*.tgz,$TYPE.snapshot} +chmod 640 $BACKUPS/{*.tgz,$TYPE.snapshot} if [ $TYPE = full ] 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. [ -e $LEVEL0 ] && rm $LEVEL0 $BACKUPS/*incremental.tgz fi