From 6a59245264e87a1ec694c27d6463d95c1429bb63 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Wed, 20 Jan 2021 15:27:12 +0100 Subject: [PATCH] Address PR comments. --- scripts/crdb_backup.sh | 11 ++++++++--- scripts/crdb_restore.sh | 9 ++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/crdb_backup.sh b/scripts/crdb_backup.sh index eb87dcdb..9ec34498 100644 --- a/scripts/crdb_backup.sh +++ b/scripts/crdb_backup.sh @@ -1,11 +1,16 @@ #!/bin/bash -# Take the current datetime: -DT=`date +%Y-%m-%d` +# Get current working directory (pwd doesn't cut it) +cwd=$(cd -P -- "$(dirname -- "$0")" && pwd -P) # Set the environment: set -o allexport -source ../.env +source $cwd/../.env set +o allexport +# Check for AWS credentials: +if [[ $AWS_ACCESS_KEY_ID == "" || $AWS_SECRET_ACCESS_KEY == "" ]]; then + echo "Missing AWS credentials!" + exit 1 +fi # Take the current datetime: DT=`date +%Y-%m-%d` # Create the backup: diff --git a/scripts/crdb_restore.sh b/scripts/crdb_restore.sh index 4892201e..f76114d1 100644 --- a/scripts/crdb_restore.sh +++ b/scripts/crdb_restore.sh @@ -6,10 +6,17 @@ if [[ $BACKUP == "" ]]; then exit 1 fi +# Get current working directory (pwd doesn't cut it) +cwd=$(cd -P -- "$(dirname -- "$0")" && pwd -P) # Set the environment: set -o allexport -source ../.env +source $cwd/../.env set +o allexport +# Check for AWS credentials: +if [[ $AWS_ACCESS_KEY_ID == "" || $AWS_SECRET_ACCESS_KEY == "" ]]; then + echo "Missing AWS credentials!" + exit 1 +fi # Restore the backup: docker exec cockroach \ cockroach sql \