LinHES Forums
http://forum.linhes.org/

Use logrotate as a backup tool
http://forum.linhes.org/viewtopic.php?f=3&t=4369
Page 1 of 1

Author:  davem [ Sun May 01, 2005 12:53 pm ]
Post subject:  Use logrotate as a backup tool

This example is to backup the videometadata table in mythconverg, but could be adapted to backup anything.

I use an external usb disk to hold my video's. If it's unmounted when the video manager is started all the video info is lost. I decided to write a script to back it up daily, and keep multiple copies around so I could always find a good one. Then I came across a tip to use logrotate to do this. Just add the code below to /etc/logrotate.conf and you'll have two weeks worth (due to the rotate 14 and daily lines) of backups of the table. They even get zipped up to save space. :)

Since it saved my butt today, I decided it was worthy of posting.

Code:
# system-specific logs may be configured here
# mythtv videometadata table backup
/var/backups/videometadata.sql {
daily
rotate 14
missingok
compress
postrotate
/usr/bin/mysqldump --opt -umythtv -pmythtv mythconverg videometadata  > /var/backups/videometadata.sql
endscript
}

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/