Created
March 30, 2017 04:25
-
-
Save rushi216/c22c4422aef32d9466e40631b2a79b52 to your computer and use it in GitHub Desktop.
This file contains 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 | |
HOST=XXX | |
DATABASE=XXX | |
USER=XXX | |
PASS=XXX | |
FILE=db-`date +"%d"`.sql | |
mysqldump --opt --host=${HOST} --user=${USER} --password=${PASS} ${DATABASE} > ${FILE} | |
tar -zcvf $FILE.tar.gz $FILE | |
rm $FILE | |
echo "${FILE}.tar.gz was created:" | |
AWS_ACCESS_KEY_ID=XXX | |
AWS_SECRET_ACCESS_KEY=XXX | |
AWS_DEFAULT_REGION=XXX | |
S3_BUCKET=XXX | |
aws s3 cp ${FILE}.tar.gz s3://${S3_BUCKET} | |
rm ${FILE}.tar.gz | |
echo "${FILE}.tar.gz was uploaded to s3 on bucket ${S3_BUCKET}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment