Skip to content

Instantly share code, notes, and snippets.

@nils-werner
Created April 29, 2011 09:20
Show Gist options
  • Save nils-werner/948092 to your computer and use it in GitHub Desktop.
Save nils-werner/948092 to your computer and use it in GitHub Desktop.
Periodic MySQL dumper
#!/bin/bash
cd /home/nils/Server/mysql
mysqldump --all-databases --dump-date=FALSE > all.sql
git commit -a -m "Dump von $(date)"
0 * * * * /home/nils/Server/mysql/backup.sh
@nils-werner
Copy link
Author

The parameter --dump-date=FALSE is necessary to hide the obligatory "Dump completed on 2011-04-29 12:00:03" line at the end of a dump.

Hiding that line will dump the exact same file over and over again if nothing has changed in the database. Git will ignore files that haven't been changed and only commit if there was an actual change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment