[mythtv-users] Thank you sd Kovacs backup script

Rick ve1gn at nb.sympatico.ca
Sat Nov 24 14:47:24 UTC 2007

Phill Edwards wrote:
>> Thank you sd kovacs!  Your daily backup script that I'm using saved my
>> bacon today.  My mythconverg database became corrupt yesterday (for no
>> apparent reason) and nothing I could do would save it.  Luckily I've
>> been using your script to keep a weeks worth of backups.  The latest
>> backup was only a few hours old so I was back in business in just a few
>> minutes.
> Sounds a great script. Would you mind posting a link to it or to the
> original mailing post about it?
> Regards,
> Phill

I just appended his script to the optimize mythdb script in contrib 
thusly. That way it optimizes the db then backs it up. I also added a 
line at the end to copy the backup to my NAS just for peace of mind.
Thinking about it, I guess you could move the optimize_mythdb.pl script 
out of contrib (because that directory changes everytime there is a new 
version of myth) and just point OPT_MYTHDB at its location.


###### optimize_mythdb.sh


echo "Started ${OPT_MYTHDB} on `date`" >> ${LOG}
echo "Finished ${OPT_MYTHDB} on `date`" >> ${LOG}

# Created on 3/22/2006 by sdkovacs
# Script: mythbackup

BACKFILE="/home/mythtv/mythbackup.`date +%a`.sql.gz"

mysqldump -u root -pyour_password_here mythconverg -c | gzip -c > 
if [ $? -ne "0" ]
         echo "Mythtv database backup failed! Exiting..."
         exit 1

cp ${BACKFILE} /htpc/backups

More information about the mythtv-users mailing list