-
-
Save dimkk/93462cb90f93cc8ac0b10ebf3b2e2f67 to your computer and use it in GitHub Desktop.
Backup MySQL dump to Azure Storage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mkdir /home/bitnami/backups/ | |
export BACKUP_FILE=/home/bitnami/backups/db-backup.sql.gz | |
export DATABASE_SCHEMA_NAME=--all-databases | |
export AZURE_CONTAINER=YOUR_VALUE_HERE | |
export AZURE_NAME=YOUR_VALUE_HERE | |
export AZURE_KEY=YOUR_VALUE_HERE | |
export AZURE_BLOB_NAME=db-production-$(date +%Y%m%d%H%M%S).sql.gz | |
/opt/bitnami/mysql/bin/mysqldump $DATABASE_SCHEMA_NAME > temp.sql | |
gzip temp.sql | |
rm -rf $BACKUP_FILE | |
mv temp.sql.gz $BACKUP_FILE | |
azure storage blob -a $AZURE_NAME -k $AZURE_KEY upload --container $AZURE_CONTAINER -f $BACKUP_FILE -b $AZURE_BLOB_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment