diff --git a/restore.sh b/restore.sh index 5eef2ee..1a98554 100755 --- a/restore.sh +++ b/restore.sh @@ -6,6 +6,11 @@ DB_NAME=`python /usr/local/bin/mongouri database` IFS="," for BACKUP_NAME in $BACKUP_NAMES do + # Get latest backup + if [ "$BACKUP_NAME" == "latest" ]; then + BACKUP_NAME=$(aws s3 ls "s3://${S3_BUCKET}/${S3_PATH}/" | tail -1 | awk '{print $NF}') + fi + # Download backup aws s3 cp "s3://${S3_BUCKET}/${S3_PATH}/${BACKUP_NAME}" "/backup/${BACKUP_NAME}" # Decompress backup with progress