Just fixed up my MySQL backup cronjob which has been broken for months and wanted to record it here. A Debian upgrade from Lenny to Squeeze broke it, iirc, so I imagine it was a change to dash or something that caught out my sloppy escaping.

I believe this originally came from Robert.

0 3 * * * /bin/bash -c "mysql -e 'show databases' | /bin/sed -n
'2,\$p' | egrep -v 'information_schema|mysql50' | xargs -L1 -I DB
mysqldump -r /home/swhitton/local/sqlbk/DB.sql DB;chown
swhitton.swhitton /home/swhitton/local/sqlbk/*.sql;chmod 600
/home/swhitton/local/sqlbk/*.sql"