Last active
December 31, 2015 10:49
-
-
Save thehenster/7975956 to your computer and use it in GitHub Desktop.
Setup Mysql backups in one fell swoop
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
# install by getting the raw url from the github interface and run something like.. | |
# curl -L https//gist.github.com/blahblah | bash | |
mkdir -p ~/backups | |
mkdir -p ~/bin | |
# a backup for each day of the month overwritting old days | |
echo "mysqldump -u root --all-databases > ~/backups/all-`date +20XX-XX-%d`.sql" > ~/bin/backup_all_mysql_databases | |
chmod 777 ~/bin/backup_all_mysql_databases | |
# do the backup at 1am | |
(crontab -l ; echo "0 1 * * * ~/bin/backup_all_mysql_databases")| crontab - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment