Mysqldump all databases and gzip

So, quick and simple MySQL backup in a CRON.

_hour=`date '+%H'`;
mysqldump -u $_user -p$_pass --all-databases --ignore-table=mysql.event | gzip > $_dest_$_hour.sql.gz

I’ve used this in an hourly CRON so that I always have 24 hours of backups.

Note: The ignore of mysql.event is to stop an annoying new feature of a later version of MySQL that seems to report a notice that its skipped this table. I don’t really need it so I am ignoring it.

Backup all SVN repos

If you need to backup your SVN repositories, then you can use this bash script to do so:

DATE=`date +"%Y-%m-%d"`
mkdir -p $BACKUP_DIR
for dir in `ls /var/svn/`; do
    svnadmin dump $RES_DIR | gzip > "${BACKUP_DIR}/${dir}.dump.gz";

This basically dumps every revision from each repository in your server, and¬†gzip’s them and then puts them in /home/user/svn/backup under the current date