Last active
January 12, 2018 15:59
-
-
Save ccbenavides/3121b3853728531a859f285dbc8b9eb6 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
### step one | |
##### bash ##### | |
#!/bin/bash | |
mysqlpass="xxxxx" | |
database="xxxxx" | |
stamp=`date +"%s-%A-%d-%B-%Y@%H%M"` | |
name="/tmp/$stamp.sql" | |
/opt/bitnami/mysql/bin/mysqldump -u root -p$mysqlpass --force --opt $database > "$name" | |
echo -e "put to s3" | |
s3cmd put "$name" s3://backup-xxxx > /tmp/s3log.log | |
echo -e "remove file local" | |
rm -f "$name" | |
### step two | |
### run bash weekly in sunday 0 | |
0 0 * * 0 bash /home/bitnami/backup.sh > /tmp/null 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if you don't use bitnami image, only change /opt/bitnami/mysql/bin/mysqldump ==> mysqldump.
if you have a error check /tmp/null, and try run script before please.