Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tar support and also support minio endpoint #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions resources/perform-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,20 @@ do
then

echo -e "Database backup successfully completed for $CURRENT_DATABASE at $(date +'%d-%m-%Y %H:%M:%S')."
backup_name=$CURRENT_DATABASE_$(date +"%Y-%m-%d_%H-%M-%S").sql

FILENAME=$CURRENT_DATABASE_$(date +"%Y-%m-%d_%H-%M-%S")

if [ "$USE_COMPRESSION" = true ]
then
tar -czvf /tmp/$CURRENT_DATABASE.tar.gz /tmp/$CURRENT_DATABASE.sql
FILENAME=$FILENAME.tar.gz
awsoutput=$(aws s3 cp /tmp/$CURRENT_DATABASE.tar.gz s3://$AWS_BUCKET_BACKUP_PATH/$FILENAME --endpoint-url $AWS_BUCKET_URI 2>&1)
else
FILENAME=$FILENAME.sql
awsoutput=$(aws s3 cp /tmp/$CURRENT_DATABASE.sql s3://$AWS_BUCKET_BACKUP_PATH/$FILENAME --endpoint-url $AWS_BUCKET_URI 2>&1)
fi
# Perform the upload to S3. Put the output to a variable. If successful, print an entry to the console and the log. If unsuccessful, set has_failed to true and print an entry to the console and the log
if awsoutput=$(aws s3 cp /tmp/$CURRENT_DATABASE.sql $AWS_BUCKET_URI$AWS_BUCKET_BACKUP_PATH/$backup_name 2>&1)
if [ "$awsoutput" = true ]
then
echo -e "Database backup successfully uploaded for $CURRENT_DATABASE at $(date +'%d-%m-%Y %H:%M:%S')."
else
Expand Down