From d644293f9b07a21fe34d42dc52a171d467184cec Mon Sep 17 00:00:00 2001 From: Hoan To Date: Tue, 6 Sep 2022 12:13:01 +0000 Subject: [PATCH] Dev 544 backup storage --- roles/backup/files/pull_remote_backups.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/backup/files/pull_remote_backups.sh b/roles/backup/files/pull_remote_backups.sh index c48eec5..ab8d20f 100644 --- a/roles/backup/files/pull_remote_backups.sh +++ b/roles/backup/files/pull_remote_backups.sh @@ -9,8 +9,10 @@ STAGE=$2 DATABASE_ENGINE=$3 DEST_DIR=${HOME}/backups/${STAGE}/${DATABASE_ENGINE}/ +# remove files oder than XX in backup-DIR +find ${DEST_DIR} -type f -mtime +1 -delete + mkdir -p ${DEST_DIR} rsync -av --remove-source-files -e "ssh -o StrictHostKeyChecking=no" ${REMOTE_SYSTEM_USER}@${DATABASE_SERVER_IP}:/backups/${DATABASE_ENGINE}/* ${DEST_DIR}/ -# remove files oder than XX in backup-DIR -find ${DEST_DIR} -ctime +7 -delete +