Created
January 13, 2016 19:56
-
-
Save lucianotonet/697054734dcab0488252 to your computer and use it in GitHub Desktop.
Backup versionado com git
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
# CONFIG Database | |
DB_NAME='' | |
DB_USER='' | |
DB_PASS='' | |
# MYSQL DUMP | |
mysqldump --skip-comments -u$DB_USER -p$DB_PASS $DB_NAME > $DB_NAME.sql | |
# GIT | |
/bin/sh -c 'cd $HOME && /usr/bin/git add --all' | |
/bin/sh -c 'cd $HOME && /usr/bin/git commit -m "Backup `date +%d%m%Y_%H%M`"' | |
/bin/sh -c 'cd $HOME && /usr/bin/git push origin master' | |
# REMOVE MYSQL DUMP | |
rm -rf $DB_NAME.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment