[mythtv-users] Schedule mythfilldatabase

Michael T. Dean mtdean at thirdcontact.com
Wed Dec 3 22:06:42 UTC 2008

On 12/03/2008 11:41 AM, Jason Gauthier wrote:
>> I think I know the problem.  Can you post the output of:
>> SELECT * FROM settings WHERE value LIKE 'MythFill%';
>> SELECT lastrun FROM housekeeping WHERE tag = 'MythFillDB';
>> so I can verify, and if either of the 2 possible issues I can think of 
>> are the case, I'll take the time to write out the why/how to fix it.
> You bet.  Appreciate the help.
> | mythfilldatabaseLastRunEnd      | 2008-12-01 14:13          | NULL
> | mythfilldatabaseLastRunStart    | 2008-12-01 14:12          | NULL
> | MythFillEnabled                 | 1                         | NULL
> | MythFillGrabberSuggestsTime     | 0                         | NULL
> | MythFillMaxHour                 | 3                         | NULL
> | MythFillMinHour                 | 2                         | NULL
> | MythFillPeriod                  | 1                         | NULL
> | MythFillSuggestedRunTime        | 2008-12-02T15:13:14       | NULL

OK, I think the problem you're having is that you've disabled "Run 
mythfilldatabase at time suggested by the grabber"*** ( 
MythFillGrabberSuggestsTime ), so you're falling back to the "let Myth 
decide when to run mfdb" approach used for XMLTV-based grabbers.  This 
approach has been modified in recent years to include a randomization to 
help spread the load on the website experienced by listings providers 
whose web sites were being scraped by XMLTV grabbers.  That means that 
it's likely that mythbackend won't run mythfilldatabase the first time 
it checks to see if it can.  Therefore, since it's not running mfdb, 
it's not doing anything useful, so it shuts down.

There's a patch at http://svn.mythtv.org/trac/ticket/4961 , which you 
could use.  Or, simply enable "Run mythfilldatabase at time suggested by 
the grabber".  The latter approach should work without modifications to 
Myth, but--as shown in the information above--it's theoretically 
possible that you may not run mythfilldatabase every single day.  In the 
above, mfdb was last run at 2008-12-01 14:13, and the grabber said to 
run it again at 2008-12-02T15:13:14 .  Since the grabber generally 
suggests running at a time > 24hrs from now (here, suggesting 25hrs 
later), if your computer wakes at 2:00am and runs mfdb and is told to 
run again at 3:00am tomorrow, but your computer doesn't have any 
recordings before 2:00am tomorrow, it will shut down until 2:00am, then 
wake, find that it's an hour too early to run and shut down until the 
next recording.

Note, though, that enabling "Run mythfilldatabase at time suggested by 
the grabber" will disable "mythfilldatabase Execution Start" and 
"mythfilldatabase Execution End" ( MythFillMinHour and MythFillMinHour, 
respectively), so mythfilldatabase could run at any time.  That means 
that you're extremely unlikely to skip a mythfilldatabase run on any day 
(because it will just run it when it wakes for a recording).

So, basically, because of the randomization stuff, you can't just tell 
your system to wake up and run mfdb at 2:00am using the built-into Myth 
functionality for running mfdb.

However, since you've already disabled "Run mythfilldatabase at time 
suggested by the grabber", there's no real benefit to running mfdb 
through Myth, so the cron job will do things the way you want.  However, 
I'd /highly/ recommend that since you're ignoring the time that 
Schedules Direct asks you to run the grabber, you should /NOT/ wake at 
2:00am, but should wake at some "not-round" number of minutes after 
2:00am to run your cron job.  For example, have your system boot up at 
2:17 or 2:42 or whatever to run mfdb (a time that's far less likely than 
"on the hour" to be used by someone else who's ignoring the suggested 
run time, thereby helping to spread out load).

***I'm assuming you're using Schedules Direct, which supports the 
suggested runtime, because of your domain name.

More information about the mythtv-users mailing list