Skip to content

Commit

Permalink
added check for env vars set
Browse files Browse the repository at this point in the history
  • Loading branch information
keithhubner committed May 9, 2024
1 parent 64044d8 commit 2895956
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions backup_script.sh
@@ -1,5 +1,16 @@
#!/bin/bash
# Cleanup function

env_vars = ["DB_HOST", "DB_USER", "DB_PASSWORD", "DB_NAME", "BUCKET", "S3_PATH", "AWS_HOST", "PUB_PRIV", "OLDER_THAN_DAYS"]

for var in "${env_vars[@]}"
do
if [ -z "${!var}" ]; then
echo "$var is not set. Exiting..."
exit 1
fi
done

cleanup() {
# Perform cleanup tasks here
echo "No errors occurred. Exiting..."
Expand Down

0 comments on commit 2895956

Please sign in to comment.