[mythtv-users] Mythconverg database maintenance
ctreleaven at cogeco.ca
ctreleaven at cogeco.ca
Tue Aug 25 13:23:32 UTC 2009
The user manual recommends running the Perl script optimize_mythdb.pl on a regular basis to keep the database tuned up.
http://www.mythtv.org/wiki/User_Manual:Periodic_Maintenance#Optimize_the_Database
Ever since I got Myth running, I've wanted to do that. But the Perl bindings aren't properly installed on my system.
(I tried LOTS of things to get them running; I'm running on Mac OS X and something is different or broken enough that
I've never succeeded.) Finally, I noticed that mySQL includes a couple of utility programs that do exactly what the
Perl script is doing. Running them from the command line worked, so I set about creating a script. I'm not an advanced
scripter so constructive feedback would be welcomed.
How is my script different from the optimize_mythdb.pl?
First, it doesn't use config.xml so you have to modify it to include your myth userid and password (and the host
location if you're not running on the database server). On the plus side, my script makes a backup of the database
before messing with it and only proceeds with analysis and repair if the backup succeeds. It then uses mysqlcheck to
--check and --auto-repair mythconverg. If that does not report an error, it uses mysqlcheck to --optimize and --analyze
the database. Finally, it calls a little Python script to email the results to me.
If you're interested, you can find the scripts on my user page at:
http://www.mythtv.org/wiki/User:Pvr4me
For you Mac OS X users, I've also got a brief section about using launchd to run this script on a regular basis--Apple
is moving towards consolidating a lot of stuff that was done by cron, init, etc, into launchd.
Craig
More information about the mythtv-users
mailing list