Skip to content

Instantly share code, notes, and snippets.

@thehenster
Last active December 31, 2015 10:49
Show Gist options
  • Save thehenster/7975956 to your computer and use it in GitHub Desktop.
Save thehenster/7975956 to your computer and use it in GitHub Desktop.
Setup Mysql backups in one fell swoop
# 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