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 +