Skip to content

Instantly share code, notes, and snippets.

@stiucsib86
Created August 3, 2014 14:44
Show Gist options
  • Save stiucsib86/ebff282a3989f9a24117 to your computer and use it in GitHub Desktop.
Save stiucsib86/ebff282a3989f9a24117 to your computer and use it in GitHub Desktop.
Backup MySQL dump to Azure Storage
#!/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
@vishnuramrbt
Copy link

Hi,
The command in git is not working for me. I used below one and got output
az storage blob upload --account-name $AZURE_NAME --account-key $AZURE_STORAGE_ACCESS_KEY --container $AZURE_CONTAINER --file $BACKUP_FILE --name $AZURE_BLOB_NAME

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment