From 998538bb12592839b769751c9195eccba89aca66 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Sun, 11 Jun 2023 18:48:16 +0200 Subject: [PATCH] chown after download of borg repo --- download-with-sftp.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/download-with-sftp.sh b/download-with-sftp.sh index cd5f11e..bdce71e 100755 --- a/download-with-sftp.sh +++ b/download-with-sftp.sh @@ -4,20 +4,22 @@ if [[ -z "${BORG_PASSPHRASE}" ]]; then echo 'BORG_PASSPHRASE is not set, cannot continue' exit fi -cd /srv/data/backup/borg/snowboard +REPO_ROOT=/srv/data/backup/borg/snowboard +SCRIPTS_DIR=/usr/local/cron/scripts +cd $REPO_ROOT mkdir -p old mv data* old backupdir="data-$(date -I)" mkdir -p $backupdir cd $backupdir -sftp fileserver@cscherr.de < /usr/local/cron/scripts/sftp-commands.txt +sftp fileserver@cscherr.de < $SCRIPTS_DIR/sftp-commands.txt status_download=$? echo "finished downloading from snowboard. Status: $status_download" borg check -v data/backup/borg/snowboard status_check=$? echo "finished checking the downloaded repo. Status: $status_check" if [ "$status_check" -eq "0" ]; then - cd /srv/data/backup/borg/snowboard + chown fileserver:fileserver $REPO_DIR/$backupdir rm -r old else echo "the new repo was not checked successfully, keeping old repo."