[mythtv-users] Mythtv automatic database backup

Don Brett dlbrett at zoominternet.net
Tue Nov 26 16:11:48 UTC 2019


On 11/24/2019 9:55 PM, Don Brett wrote:
> On 11/24/2019 2:36 PM, Mike Bibbings wrote:
>> On 24/11/2019 18:47, Don Brett wrote:
>>> On 11/24/2019 10:08 AM, Mike Bibbings wrote:
>>>> On 24/11/2019 14:30, Don Brett wrote:
>>>>> Does Mythtv do automatic database backups, or do I need to setup 
>>>>> my own cron job?  Years ago, I thought it did it by itself.
>>>>>
>>>>> Don
>>>>>
>>>> The packaged versions of mythtv e.g. on Ubuntu should automatically 
>>>> do a backup weekly, keeping the last 5 backups.
>>>>
>>>> Note there is a bug in mythtv 30 in that the backup fails.
>>>>
>>>> This has been fixed in mythtv master (31pre).
>>>>
>>>> If you want a weekly backup, replace the contents of file 
>>>> /etc/cron.weekly/mythtv-database
>>>>
>>>> with the contents from 
>>>> https://github.com/MythTV/packaging/blob/master/deb/debian/mythtv-database.cron.weekly
>>>>
>>>> Personally, I put the corrected mythtv-database file in 
>>>> /etc/cron.daily/ for a daily backup.
>>>>
>>>>
>>>> Mike
>>>>
>>>>
>>>> _______________________________________________
>>>> mythtv-users mailing list
>>>> mythtv-users at mythtv.org
>>>> http://lists.mythtv.org/mailman/listinfo/mythtv-users
>>>> http://wiki.mythtv.org/Mailing_List_etiquette
>>>> MythTV Forums: https://forum.mythtv.org
>>>
>>> I added the updated script to /etc/cron.daily.  It runs manually, 
>>> but not sure how to get cron to run it on demand for a test.  I'm 
>>> happy to wait until tomorrow to see the results. By the way, it 
>>> doesn't look like the script does the rotate feature, it that done 
>>> somewhere else, or do I need to add something?
>>>
>>>  Don
>>
>>
>> The mythtv-database script calls 
>> /usr/share/mythtv/mythconverg_backup.pl which has a built-in default 
>> of 5 for backups to keep.
>>
>> To test manually, this will force all cron.daily jobs to be run:
>>
>> sudo run-parts /etc/cron.daily
>>
>> and check that a new database backup has been created.
>>
>>
>> Mike
>>
>> sudo anacron -n -d -f
>>
> Hmmm, when running "sudo run-parts /etc/cron.daily", but prompt goes 
> away for a few seconds and comes right back; nothing new created.  
> Backup on this box usually takes about 30 + seconds.  I assumed cron's 
> schedule was satisfied for the day, so wouldn't run it again.
>
> Running anacron also returns pretty quickly (under 5 seconds):
>
> don at johnny:~$ sudo anacron -n -d -f
> Anacron 2.3 started on 2019-11-24
> Will run job `cron.daily'
> Will run job `cron.weekly'
> Will run job `cron.monthly'
> Jobs will be executed sequentially
> Job `cron.daily' started
> Job `cron.daily' terminated
> Job `cron.weekly' started
> Job `cron.weekly' terminated
> Job `cron.monthly' started
> Job `cron.monthly' terminated
> Normal exit (3 jobs run)
> don at johnny:~$
>
> I'll let you know if it creates one overnight,
>
> Don
>

Apparently, cron doesn't like script file names that have periods. I had 
simply dropped "mythtv-database.cron.weekly" into /etc/cron.daily, but 
it wouldn't run until I changed it to mythtv-database-cron-daily.  Also 
added rotate into the command, directly in the script:

$CMDPREFIX /usr/share/mythtv/mythconverg_backup.pl --rotate 10

Looks like it works now.  Stephen's script also looks pretty 
interesting, but backups aren't going to a network drive at the moment 
(they probably should), so I'll circle back when I get to it.  Thanks 
for all the  help,

Don

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20191126/8d55f1b9/attachment.htm>


More information about the mythtv-users mailing list