I've been using rdiffbackup for mysql backups for years, and currently
just dump all my databases to a temporary directory, rdiff-backup
that, then delete the temporary directory (since rdiff keeps a current
mirror anyway).  The downside is it uses extra space equivalent to all
your current version backups while the script is running, so if you
don't have that much extra space, I don't know of the solution.  Here
is the script I use:

#!/bin/bash
cd /path/to/backup/
USERNAME="root"
PASSWORD="password"

# subject for email
echo "dumpdbs report"

echo "grabbing database to dump"

# list them manually
#DATABASES="wordpress mediawiki"
# or automatically
DATABASES=$(mysql -u$USERNAME -p$PASSWORD -e "SHOW DATABASES;" | tr -d
"| " | grep -v Database)

echo "dumping these databases: '$(echo "$DATABASES" | tr '\n' ' ')'"

# backup databases
mkdir -p tmp
for database in $DATABASES
do
        echo "dumping database $database"
# rdiff-backup is useless on compressed data, so don't do this anymore
#       mysqldump -u$USERNAME -p$PASSWORD --single-transaction
$database | bzip2 -c > ./tmp/$database.sql.bz2
        mysqldump -u$USERNAME -p$PASSWORD --single-transaction
$database > ./tmp/$database.sql
done

echo "rdiffing databases"

rdiff-backup ./tmp ./dbs
rm -rf tmp


On Tue, Jun 11, 2013 at 10:59 AM, Eric Beversluis
<[email protected]> wrote:
> I want to create a cron job to do mysqldump and run the output through
> rdiff-backup so it goes right into /home/eric/repository/mysql. Can
> someone give me the correct syntax for that? Do I have to do the mysql
> dump to a particular file and then rdiff that file? (Which would mean
> I'd have to overwrite that file each time.) Or is there some way I can
> just pipe the mysqldump output right through rdiff-backup?
>
> Thanks
>
>
> _______________________________________________
> rdiff-backup-users mailing list at [email protected]
> https://lists.nongnu.org/mailman/listinfo/rdiff-backup-users
> Wiki URL: http://rdiff-backup.solutionsfirst.com.au/index.php/RdiffBackupWiki

_______________________________________________
rdiff-backup-users mailing list at [email protected]
https://lists.nongnu.org/mailman/listinfo/rdiff-backup-users
Wiki URL: http://rdiff-backup.solutionsfirst.com.au/index.php/RdiffBackupWiki

Reply via email to