[mythtv-commits] Ticket #4760: Use a script for the database backup

MythTV mythtv at cvs.mythtv.org
Sat May 3 04:07:37 UTC 2008


#4760: Use a script for the database backup
----------------------------------------------+-----------------------------
 Reporter:  sphery <mtdean at thirdcontact.com>  |        Owner:  ijr    
     Type:  patch                             |       Status:  new    
 Priority:  minor                             |    Milestone:  unknown
Component:  mythtv                            |      Version:  head   
 Severity:  medium                            |   Resolution:         
  Mlocked:  0                                 |  
----------------------------------------------+-----------------------------

Comment(by sphery <mtdean at thirdcontact.com>):

 mythtv-4760-database_backup_using_script.patch is an updated patch, tested
 with post-Qt4 trunk, that takes into account Nigel's suggestion of keeping
 the "built-in" DBUtil::DoBackup(QString) as well as adding a new
 (preferred) DBUtil::DoBackup(QString, QString) that calls a script as
 described above.  (Though I now realize that my original description
 specified variables names of the form dbXxx--such as dbName--when really
 it has always been of the form DBXxx--such as DBName.)

 mythtv-4760-database_backup_scripts.patch provides both a backup
 (database_mythconverg_backup.pl) and restore
 (database_mythconverg_restore.pl) script, written in Perl.  The Perl
 scripts are much more understandable than the shell scripts and have more
 functionality.  The scripts will work with any version of MythTV and only
 require the modules Getopt::Long and File::Temp; however, it is strongly
 recommended that the DBI and DBD::mysql modules also be installed.  If
 IO::Compress::Gzip or IO::Uncompress::Gunzip (for backup and restore,
 respectively) are installed, compression/uncompression will be
 "internally" without using the external gzip executable.  Neither
 DBI/DBD::mysql nor IO::Compress/IO::Uncompress are required (the script
 will check for their presence and use them only if available).

 Once a script-based backup capability goes into Myth, I will write up and
 submit a patch for the HOWTO documentation.

 When testing the script-based backup, you may use the "hidden" DB setting
 BackupDBScriptArgs with the value '--verbose' to see what the script is
 doing.

 Script Highlights:

 The backup script can be used automatically by mythbackend or "manually"
 by users.  It will automatically determine as much information as possible
 (generally only requiring the user specify a DBBackupDirectory) and
 supports a backup resource file to make usage easier.  After creating the
 backup, it will compress it (by default using the gzip algorithm, but
 allows the user to specify a compression program so those who would rather
 trade a lot of CPU resources for a little disk space can use bzip2).  It
 will also rotate backup files (by default keeping 5 backups and removing
 the oldest).  See the --help output for (way too much) information (and a
 quick start).

 The restore script can be called to do a full restore (i.e. as at
 http://mythtv.org/docs/mythtv-HOWTO-23.html#ss23.5 ) or a partial/new-
 hardware restore (as at http://mythtv.org/docs/mythtv-HOWTO-23.html#ss23.7
 ).  Like the backup script, it will automatically determine as much
 information as possible (again, generally only requiring the user specify
 a DBBackupDirectory) and supports a backup resource file to make usage
 easier.  If no backup filename is specified, it will attempt to find the
 newest backup file (based on filename).  It will automatically uncompress
 backups.  It also allows the user to specify the location of the mc.sql
 file and will attempt to create the initial database, if the database does
 not already exist.  Again, see the --help output for full details (and a
 quick start).

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/4760#comment:2>
MythTV <http://www.mythtv.org/>
MythTV


More information about the mythtv-commits mailing list