Fri, 03 Feb 2006

Cron and Backups

I wanted to backup my MediaWiki each night and found that a little addition to my crontab would do the trick quite nicely:

05 05 * * * mysqldump --user=wikiuser --password=s3kr1t --single-transaction --all-databases | bzip2 > /path/wiki.`date +\%Y\%m\%d`.sql.bz2

Since this is on Solaris, the % signs need to be escaped, otherwise they represent newlines. But, when I tried to use `date '+\%Y\%m\%d'` the backslashes got left in the output too. Smells like a bug to me.

I should probably backup the actual MediaWiki files too. Oh, and I'll have to clean out the backups every so often, I suppose.

[/unix] permanent link

November 2022
Sun Mon Tue Wed Thu Fri Sat