Created
May 11, 2016 14:09
-
-
Save marcelog/2d50b295e8641d45a32b3269b42e8eb3 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/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
i face error, when i run this script. i keep port 3306
Error backing up mysql
Error backing up mysql
our method is down.
mysqldump
--host ${localhost}
--port ${3306}
-u ${user123}
--password="${password123}"
${database123} > ${file}