[mythtv-users] 5 Db rotate

Stephen Worthington stephen_agent at jsw.gen.nz
Sat Nov 22 16:37:34 UTC 2014


On Sat, 22 Nov 2014 16:37:42 +0100, you wrote:

>Hoi Daryl,
>
>Saturday, November 22, 2014, 4:18:04 PM, you wrote:
>
>
>> On Nov 22, 2014 10:08 AM, "Stephen Worthington" <stephen_agent at jsw.gen.nz> wrote:
>>>
>>> On Sat, 22 Nov 2014 09:23:31 -0500, you wrote:
>>>
>>> >Greetings Mythizens, I remember in previous setups having the 5 latest Db
>>> >backups kept in /var/lib/mythtv/db_backups. That's not happening now, I am
>>> >getting mythbuntu backups as a result of MCC, but they don't rotate, I go
>>> >in and cull once in a while. From looking at the wiki I have the backup and
>>> >restore scripts in /usr/share/mythtv, and I echo'd the location I want the
>>> >backups to land in, my question is how do I set the frequency to daily and
>>> >select the time? IIRC this used to happen without a cron job.
>>> >Sort of related the box doesn't wakeup for Db backups or MFDB's is this
>>> >even possible?     TIA Daryl
>>>
>>> In Mythbuntu, the backups are normally done weekly by a cron job that
>>> is installed by one of the Mythbuntu packages:
>>>
>>>   /etc/cron.weekly/mythtv-database
>>>
>>> That file contains this in 14.04:
>>>
>>> #!/bin/sh
>>> # /etc/cron.weekly/mythtv-database script - check and backup
>>> mythconverg tables
>>> # Copyright 2005/12/02 2006/10/08 Paul Andreassen
>>> #                      2010 Mario Limonciello
>>>
>>> set -e -u
>>>
>>> DBNAME="mythconverg"
>>> DEBIAN="--defaults-extra-file=/etc/mysql/debian.cnf"
>>>
>>> /usr/bin/mysqlcheck $DEBIAN -s $DBNAME
>>>
>>> /usr/share/mythtv/mythconverg_backup.pl
>>>
>>> /usr/bin/logger -p daemon.info-i -t${0##*/} "$DBNAME checked and
>>> backedup."
>>>
>>> # End of file.
>>>
>>>
>>> I have put a modified copy of that file in /etc/cron.daily to also do
>>> daily backups to another PC on my network:
>>>
>>> #!/bin/sh
>>> # /etc/cron.weekly/mythtv-database script - check and backup
>>> mythconverg tables
>>> # Copyright 2005/12/02 2006/10/08 Paul Andreassen
>>> #                      2010 Mario Limonciello
>>>
>>> # JSW Modified for /etc/cron.daily backups to a network drive.
>>>
>>> set -e -u
>>>
>>> DBNAME="mythconverg"
>>> DEBIAN="--defaults-extra-file=/etc/mysql/debian.cnf"
>>>
>>> # Debug:
>>> /usr/bin/logger -p daemon.info-i -t${0##*/} "Debug: $DBNAME
>>> cron.daily checking started."
>>>
>>> /usr/bin/mysqlcheck $DEBIAN -s $DBNAME
>>>
>>> # Debug:
>>> /usr/bin/logger -p daemon.info-i -t${0##*/} "Debug: $DBNAME
>>> cron.daily checking finished, backup starting."
>>>
>>> /usr/share/mythtv/mythconverg_backup.pl--directory
>>> "/mnt/savaidh/ldrive/Backups/MythTV_db_backup/mypvr"
>>>
>>> /usr/bin/logger -p daemon.info-i -t${0##*/} "$DBNAME checked and
>>> backedup."
>>>
>>> # End of file.
>>>
>>>
>>> The real work is done by the /usr/share/mythtv/mythconverg_backup.pl
>>> script, which is where the default rotation is set.  Use
>>>
>>>   /usr/share/mythtv/mythconverg_backup.pl--help
>>>
>>> and
>>>
>>>   /usr/share/mythtv/mythconverg_backup.pl--help --help
>>>
>>> for help.  It looks like there is a --rotate option to override the
>>> default value.
>>> _______________________________________________

>> Default value is acceptable, mythconverg is not backing up on its
>> own, I have to run the script, I can't confirm or deny whether it is
>> rotating or not at this point. Do I need to disable MCC backups for mythconverg to run automatic?

I think the MCC backups are the same thing as the cron.weekly script.
You could try disabling the MCC backup option and saving that, then
re-enabling it again.  And check to see if you have the
/etc/cron.weekly/mythtv-database script.

>I use following script, I think I picked from the wiki as a daily
>cronjob. It automatically only keeps the 5 latest. The location is set
>through theDB Backups storage group.
>
>#!/bin/bash
>
>cd /home/samba/sysBackup
>
>OPT_MYTHDB='/usr/share/mythtv/mythconverg_backup.pl'
>LOG='/var/log/mythtv/backup.log'
>
>echo "Started ${OPT_MYTHDB} on `date`" >> ${LOG}
>${OPT_MYTHDB} >> ${LOG}
>echo "Finished ${OPT_MYTHDB} on `date`" >> ${LOG}

Hika - Your backup script is missing the bit that runs mysqlcheck to
check the database before backing it up.  I would really recommend
adding that in as it keeps the database in a safe state.  If regular
checks are not done, any errors in the database can accumulate to the
point where it stops working.


More information about the mythtv-users mailing list