Created
June 25, 2017 04:17
-
-
Save codemilli/2e04e85c53983b82216b1cdba050fdca to your computer and use it in GitHub Desktop.
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/bash | |
cd /tmp | |
file=$(date +%a).sql | |
mysqldump \ | |
--host ${MYSQL_HOST} \ | |
--port ${MYSQL_PORT} \ | |
-u ${MYSQL_USER} \ | |
--password="${MYSQL_PASS}" \ | |
${MYSQL_DB} > ${file} | |
if [ "${?}" -eq 0 ]; then | |
gzip ${file} | |
aws s3 cp ${file}.gz s3://${S3_BUCKET} | |
rm ${file}.gz | |
else | |
echo "Error backing up mysql" | |
exit 255 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment