[mythtv-users] Populating the .xmltv file for my grabber from mythtv database?

Dan Ritter dsr-myth at randomstring.org
Mon May 10 13:06:23 UTC 2021

David Watkins wrote: 
> I have a combined BE/FE which shuts down when not being used and wakes up
> for recordings.  I run this script from crondaily and it seems to work out
> OK.
> #!/usr/bin/bash
> /usr/local/bin/mythshutdown --lock
> tv_grab_zz_sdjson --days 10 --config-file ~/.xmltv/tv_grab_zz_sdjson.conf
> --output ~/sd_listing.xml 2>/dev/null
> /usr/local/bin/mythfilldatabase --only-update-guide --max-days 10 --file
> --sourceid 2 --xmlfile ~/sd_listing.xml 2>/dev/null
> /usr/local/bin/mythshutdown --unlock
> It's not an ideal solution because I have a low powered ION motherboard
> with only 4GB RAM and  this more or less guarantees that MFD will run while
> a recording is in progress when I'd prefer to ensure it ran when the box
> wasn't recording.  Also, if  I ever go more than 10 days without a
> scheduled recording the whole thing will come to a stop because it will run
> out of guide data and never wake up to load any more.  In practice neither
> of those things causes a problem.

For your first not-currently-a-problem: you could switch to
running your grabber/MFD as part of shutdown of the box.


shows methods for doing so with sysvinit and systemd.

You would probably want to create a lock file and only run if that
file is more than 24 hours old. Remember that ctime is metadata
change time and mtime is modification change time -- echo'ing
something to that file will both create it if necessary and
modify it, so that's your best bet.

For your second not-currently-a-problem, you would probably have
to parse the current rtcwake value, decide if it's too far into
the future, and if so, save it, set the new value to n<10 days
out, and then on boot pull the old value out of a file and
re-apply it.


More information about the mythtv-users mailing list