Mailing List Archive

Mythfilldatabase
Just recently updated to mythtv 31.0 on Arch Linux. I moved the
SchedulesDirect setup to tv_grab_zz_sdjson and am having a very strange
thing happen which I can't figure out.

If I run mythfilldatabase manually at the commandline, everything works
perfectly. If I add it to a cron job, it fails with the following error:

tv_grab_zz_sdjson --capabilities failed or we timed out waiting. You
may need to upgrade your xmltv grabber

Grabbing XMLTV data using tv_grab_zz_sdjson is not supported. You may
need to upgrade to the latest version of XMLTV.

Again, it works perfectly, as long as it isn't run from cron and I can't
figure out why. Any suggestions?

--
Matthew Daubenspeck
http://oddprocess.org

Gentoo Linux x86_64 AMD EPYC 7501 32-Core Processor
14:21:03 up 25 days, 21:40, 5 users, load average: 0.14, 0.12, 0.09
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Mythfilldatabase [ In reply to ]
On 5/13/20 1:25 PM, Matthew Daubenspeck wrote:
> Just recently updated to mythtv 31.0 on Arch Linux. I moved the
> SchedulesDirect setup to tv_grab_zz_sdjson and am having a very strange
> thing happen which I can't figure out.
>
> If I run mythfilldatabase manually at the commandline, everything works
> perfectly. If I add it to a cron job, it fails with the following error:
>
> tv_grab_zz_sdjson --capabilities failed or we timed out waiting. You
> may need to upgrade your xmltv grabber
>
> Grabbing XMLTV data using tv_grab_zz_sdjson is not supported. You may
> need to upgrade to the latest version of XMLTV.
>
> Again, it works perfectly, as long as it isn't run from cron and I can't
> figure out why. Any suggestions?
>

This happens more often than expected. There's a warning and instructions
that suggest running the setup as the user that runs mythfilldatabase.

That user is usually 'mythtv' and the backend is run as that user (started
by root though.)

I don't speak Arch. But if the user running the backend and the user running
the grabber from the command line are different, things likely fail IF when
configured, the files (e.g. ~mythtv/.mythtv/SOURCENAME/.xmltv and ~mythtv/.xmltv/
SchedulesDirect.DB) aren't in the expected place. Typically, that's relative
to the HOME directory of the user running a mythProgramName.

Of course, there's always MYTHCONFDIR. https://www.mythtv.org/wiki/MYTHCONFDIR
Be sure to see if the backend and/or user programs use that because it overrides
the value of HOME.

If the above isn't in play, then run the configuration program and
mythfilldatabase with this:

sudo --set-home --login --user=mythtv ...

As to cron, see if the 6th field is the user that did the setup,
again, most likely user mythtv. If it's user root, then configuration
files aren't available. Sounds like yours are under your own user's
directory. Note that the user running related programs must have r/w
access to the involved files and rwx on .xmltv.

--

Bill
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Mythfilldatabase [ In reply to ]
On Wed, 13 May 2020 14:25:05 -0400, you wrote:

>Just recently updated to mythtv 31.0 on Arch Linux. I moved the
>SchedulesDirect setup to tv_grab_zz_sdjson and am having a very strange
>thing happen which I can't figure out.
>
>If I run mythfilldatabase manually at the commandline, everything works
>perfectly. If I add it to a cron job, it fails with the following error:
>
>tv_grab_zz_sdjson --capabilities failed or we timed out waiting. You
>may need to upgrade your xmltv grabber
>
>Grabbing XMLTV data using tv_grab_zz_sdjson is not supported. You may
>need to upgrade to the latest version of XMLTV.
>
>Again, it works perfectly, as long as it isn't run from cron and I can't
>figure out why. Any suggestions?

That sounds like the classic problem of cron running jobs as root, and
mythfilldatabase needs to be run from your mythtv user normally. If
you are any good at systemd, you might like to consider running
mythfilldatabase as a systemd timer unit - systemd makes it easy to
run things as different users.

Here is what I think a systemd setup to run mythfilldatabase as the
mythtv user should look like. Note that I have not tested this:

Create a file /etc/systemd/system/mythfilldatabase.service:

[Unit]
Description=MythTV mythfilldatabase service.
Wants=mythtv-backend.service
After=mythtv-backend.service

[Service]
User=mythtv
Group=mythtv
Type=simple
ExecStart=/usr/bin/mythfilldatabase

[Install]
WantedBy=multi-user.target

And then create a file /etc/systemd/system/mythfilldatabase.timer:

[Unit]
Description=MythTV mythfilldatabase timer.

[Timer]
OnCalendar=15:10:00
Persistent=true

[Install]
WantedBy=timers.target

Those files need to be chown root:root and chmod u=rw,g=r,u=r.

Change the OnCalendar= setting to whenever you want mythfilldatabase
to be run. You can have as many OnCalendar= lines as you like.

The do these commands:

sudo systemctl daemon-reload
sudo systemctl enable mythfilldatabase.service
sudo systemctl enable mythfilldatabase.timer
sudo systemctl start mythfilldatabase.timer

If you want to manually run mythfilldatabase:

sudo systemctl start mythfilldatabase.service

If you only want mythfilldatabase to be run at the time specified, and
not at boot time if the timer was missed, then do not enable the
mythfilldatabase.service.


The way to run cron jobs as different users is to change your command
prompt to that user:

su -l mythtv

and then run:

crontab -e

That puts you in your default command line editor (nano in my case) on
the crontab file for that user. Put your mythfilldatabase cron job
there, save and exit. Remove the anacron job from /etc/cron.daily or
wherever you currently have it.

Note that user cron jobs are cron jobs, not anacron jobs. They are
run at the time specified only, and are not queued and run in sequence
with other jobs as cron.daily jobs are. And they do not get run
automatically at boot if the time was missed due to the PC being shut
down.

My mythfilldatabase runs from my user crontab, as I have been running
it there since well before Ubuntu changed to systemd.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Mythfilldatabase [ In reply to ]
On Thu, May 14, 2020 at 03:19:31PM +1200, Stephen Worthington wrote:
> On Wed, 13 May 2020 14:25:05 -0400, you wrote:
>
> >Just recently updated to mythtv 31.0 on Arch Linux. I moved the
> >SchedulesDirect setup to tv_grab_zz_sdjson and am having a very strange
> >thing happen which I can't figure out.
> >
> >If I run mythfilldatabase manually at the commandline, everything works
> >perfectly. If I add it to a cron job, it fails with the following error:
> >
> >tv_grab_zz_sdjson --capabilities failed or we timed out waiting. You
> >may need to upgrade your xmltv grabber
> >
> >Grabbing XMLTV data using tv_grab_zz_sdjson is not supported. You may
> >need to upgrade to the latest version of XMLTV.
> >
> >Again, it works perfectly, as long as it isn't run from cron and I can't
> >figure out why. Any suggestions?
>
> That sounds like the classic problem of cron running jobs as root, and
> mythfilldatabase needs to be run from your mythtv user normally. If
> you are any good at systemd, you might like to consider running
> mythfilldatabase as a systemd timer unit - systemd makes it easy to
> run things as different users.
>
> Here is what I think a systemd setup to run mythfilldatabase as the
> mythtv user should look like. Note that I have not tested this:
>
> Create a file /etc/systemd/system/mythfilldatabase.service:
>
> [Unit]
> Description=MythTV mythfilldatabase service.
> Wants=mythtv-backend.service
> After=mythtv-backend.service
>
> [Service]
> User=mythtv
> Group=mythtv
> Type=simple
> ExecStart=/usr/bin/mythfilldatabase
>
> [Install]
> WantedBy=multi-user.target
>
> And then create a file /etc/systemd/system/mythfilldatabase.timer:
>
> [Unit]
> Description=MythTV mythfilldatabase timer.
>
> [Timer]
> OnCalendar=15:10:00
> Persistent=true
>
> [Install]
> WantedBy=timers.target
>
> Those files need to be chown root:root and chmod u=rw,g=r,u=r.
>
> Change the OnCalendar= setting to whenever you want mythfilldatabase
> to be run. You can have as many OnCalendar= lines as you like.
>
> The do these commands:
>
> sudo systemctl daemon-reload
> sudo systemctl enable mythfilldatabase.service
> sudo systemctl enable mythfilldatabase.timer
> sudo systemctl start mythfilldatabase.timer
>
> If you want to manually run mythfilldatabase:
>
> sudo systemctl start mythfilldatabase.service
>
> If you only want mythfilldatabase to be run at the time specified, and
> not at boot time if the timer was missed, then do not enable the
> mythfilldatabase.service.
>
>
> The way to run cron jobs as different users is to change your command
> prompt to that user:
>
> su -l mythtv
>
> and then run:
>
> crontab -e
>
> That puts you in your default command line editor (nano in my case) on
> the crontab file for that user. Put your mythfilldatabase cron job
> there, save and exit. Remove the anacron job from /etc/cron.daily or
> wherever you currently have it.
>
> Note that user cron jobs are cron jobs, not anacron jobs. They are
> run at the time specified only, and are not queued and run in sequence
> with other jobs as cron.daily jobs are. And they do not get run
> automatically at boot if the time was missed due to the PC being shut
> down.
>
> My mythfilldatabase runs from my user crontab, as I have been running
> it there since well before Ubuntu changed to systemd.
> _______________________________________________

I'm about to throw something!

I've tried multiple cron settings, like you suggested, and get the same
results. My normal user runs mythtv-setup, and has run mythfilldatabase
for years just fine, until the change to the SD JSON grabber. I tried
the systemd method as well, it gets the same error:

tv_grab_zz_sdjson --capabilities failed or we timed out waiting...

I've tried scripts running as other users, I've read and re-read both
replies to my original message, as well as both wiki articles on xmltv
and mythfilldatabase. Neither of them seem to make a difference.
Everything runs fine when I run them manually, but as soon as cron is
involved, it errors out and doesn't work.

I copied all of the .mythtv and .xmltv directories to a newly created
mythtv home directory, and again, it runs fine if I do so manually. But
add it to cron, or your systemd suggestion, and it errors out the same
way.

I'm almost to the point of having another machine run a cronjob over ssh
just to get it to work.

I also tried sudo --set-home --login --user=mythtv ... but I guess I
don't understand what the ... should be, as any command I use there does
nothing and returns to the prompt.

I'm stuck!


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Mythfilldatabase [ In reply to ]
Each time mythfilldatabase runs, it creates a logfile in /var/log or
elsewhere, find this logfile and see what is in it.

When things failed for me. it was because the mythbackend was launching it
as a different user and using a different configuration file path. This
error was seen in the logfiles. I believe in my case it was trying to find
the config files in /etc or /var/lib or somewhere else, so copy the config
files from the working user location to the new location it is expecting.

Find where mythfilldatabase logs and start from there.

On Fri, May 15, 2020 at 2:22 PM Matthew Daubenspeck <matt@oddprocess.org>
wrote:

> On Thu, May 14, 2020 at 03:19:31PM +1200, Stephen Worthington wrote:
> > On Wed, 13 May 2020 14:25:05 -0400, you wrote:
> >
> > >Just recently updated to mythtv 31.0 on Arch Linux. I moved the
> > >SchedulesDirect setup to tv_grab_zz_sdjson and am having a very strange
> > >thing happen which I can't figure out.
> > >
> > >If I run mythfilldatabase manually at the commandline, everything works
> > >perfectly. If I add it to a cron job, it fails with the following error:
> > >
> > >tv_grab_zz_sdjson --capabilities failed or we timed out waiting. You
> > >may need to upgrade your xmltv grabber
> > >
> > >Grabbing XMLTV data using tv_grab_zz_sdjson is not supported. You may
> > >need to upgrade to the latest version of XMLTV.
> > >
> > >Again, it works perfectly, as long as it isn't run from cron and I can't
> > >figure out why. Any suggestions?
> >
> > That sounds like the classic problem of cron running jobs as root, and
> > mythfilldatabase needs to be run from your mythtv user normally. If
> > you are any good at systemd, you might like to consider running
> > mythfilldatabase as a systemd timer unit - systemd makes it easy to
> > run things as different users.
> >
> > Here is what I think a systemd setup to run mythfilldatabase as the
> > mythtv user should look like. Note that I have not tested this:
> >
> > Create a file /etc/systemd/system/mythfilldatabase.service:
> >
> > [Unit]
> > Description=MythTV mythfilldatabase service.
> > Wants=mythtv-backend.service
> > After=mythtv-backend.service
> >
> > [Service]
> > User=mythtv
> > Group=mythtv
> > Type=simple
> > ExecStart=/usr/bin/mythfilldatabase
> >
> > [Install]
> > WantedBy=multi-user.target
> >
> > And then create a file /etc/systemd/system/mythfilldatabase.timer:
> >
> > [Unit]
> > Description=MythTV mythfilldatabase timer.
> >
> > [Timer]
> > OnCalendar=15:10:00
> > Persistent=true
> >
> > [Install]
> > WantedBy=timers.target
> >
> > Those files need to be chown root:root and chmod u=rw,g=r,u=r.
> >
> > Change the OnCalendar= setting to whenever you want mythfilldatabase
> > to be run. You can have as many OnCalendar= lines as you like.
> >
> > The do these commands:
> >
> > sudo systemctl daemon-reload
> > sudo systemctl enable mythfilldatabase.service
> > sudo systemctl enable mythfilldatabase.timer
> > sudo systemctl start mythfilldatabase.timer
> >
> > If you want to manually run mythfilldatabase:
> >
> > sudo systemctl start mythfilldatabase.service
> >
> > If you only want mythfilldatabase to be run at the time specified, and
> > not at boot time if the timer was missed, then do not enable the
> > mythfilldatabase.service.
> >
> >
> > The way to run cron jobs as different users is to change your command
> > prompt to that user:
> >
> > su -l mythtv
> >
> > and then run:
> >
> > crontab -e
> >
> > That puts you in your default command line editor (nano in my case) on
> > the crontab file for that user. Put your mythfilldatabase cron job
> > there, save and exit. Remove the anacron job from /etc/cron.daily or
> > wherever you currently have it.
> >
> > Note that user cron jobs are cron jobs, not anacron jobs. They are
> > run at the time specified only, and are not queued and run in sequence
> > with other jobs as cron.daily jobs are. And they do not get run
> > automatically at boot if the time was missed due to the PC being shut
> > down.
> >
> > My mythfilldatabase runs from my user crontab, as I have been running
> > it there since well before Ubuntu changed to systemd.
> > _______________________________________________
>
> I'm about to throw something!
>
> I've tried multiple cron settings, like you suggested, and get the same
> results. My normal user runs mythtv-setup, and has run mythfilldatabase
> for years just fine, until the change to the SD JSON grabber. I tried
> the systemd method as well, it gets the same error:
>
> tv_grab_zz_sdjson --capabilities failed or we timed out waiting...
>
> I've tried scripts running as other users, I've read and re-read both
> replies to my original message, as well as both wiki articles on xmltv
> and mythfilldatabase. Neither of them seem to make a difference.
> Everything runs fine when I run them manually, but as soon as cron is
> involved, it errors out and doesn't work.
>
> I copied all of the .mythtv and .xmltv directories to a newly created
> mythtv home directory, and again, it runs fine if I do so manually. But
> add it to cron, or your systemd suggestion, and it errors out the same
> way.
>
> I'm almost to the point of having another machine run a cronjob over ssh
> just to get it to work.
>
> I also tried sudo --set-home --login --user=mythtv ... but I guess I
> don't understand what the ... should be, as any command I use there does
> nothing and returns to the prompt.
>
> I'm stuck!
>
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org
>
Re: Mythfilldatabase [ In reply to ]
On 5/15/20 4:21 PM, Matthew Daubenspeck wrote:
> On Thu, May 14, 2020 at 03:19:31PM +1200, Stephen Worthington wrote:
>> On Wed, 13 May 2020 14:25:05 -0400, you wrote:
>>
>>> Just recently updated to mythtv 31.0 on Arch Linux. I moved the
>>> SchedulesDirect setup to tv_grab_zz_sdjson and am having a very strange
>>> thing happen which I can't figure out.
>>>
>>> If I run mythfilldatabase manually at the commandline, everything works
>>> perfectly. If I add it to a cron job, it fails with the following error:
>>>
>>> tv_grab_zz_sdjson --capabilities failed or we timed out waiting. You
>>> may need to upgrade your xmltv grabber
>>>
>>> Grabbing XMLTV data using tv_grab_zz_sdjson is not supported. You may
>>> need to upgrade to the latest version of XMLTV.
>>>
>>> Again, it works perfectly, as long as it isn't run from cron and I can't
>>> figure out why. Any suggestions?
>>
>> That sounds like the classic problem of cron running jobs as root, and
>> mythfilldatabase needs to be run from your mythtv user normally. If
>> you are any good at systemd, you might like to consider running
>> mythfilldatabase as a systemd timer unit - systemd makes it easy to
>> run things as different users.
>>
>> Here is what I think a systemd setup to run mythfilldatabase as the
>> mythtv user should look like. Note that I have not tested this:
>>
>> Create a file /etc/systemd/system/mythfilldatabase.service:
>>
>> [Unit]
>> Description=MythTV mythfilldatabase service.
>> Wants=mythtv-backend.service
>> After=mythtv-backend.service
>>
>> [Service]
>> User=mythtv
>> Group=mythtv
>> Type=simple
>> ExecStart=/usr/bin/mythfilldatabase
>>
>> [Install]
>> WantedBy=multi-user.target
>>
>> And then create a file /etc/systemd/system/mythfilldatabase.timer:
>>
>> [Unit]
>> Description=MythTV mythfilldatabase timer.
>>
>> [Timer]
>> OnCalendar=15:10:00
>> Persistent=true
>>
>> [Install]
>> WantedBy=timers.target
>>
>> Those files need to be chown root:root and chmod u=rw,g=r,u=r.
>>
>> Change the OnCalendar= setting to whenever you want mythfilldatabase
>> to be run. You can have as many OnCalendar= lines as you like.
>>
>> The do these commands:
>>
>> sudo systemctl daemon-reload
>> sudo systemctl enable mythfilldatabase.service
>> sudo systemctl enable mythfilldatabase.timer
>> sudo systemctl start mythfilldatabase.timer
>>
>> If you want to manually run mythfilldatabase:
>>
>> sudo systemctl start mythfilldatabase.service
>>
>> If you only want mythfilldatabase to be run at the time specified, and
>> not at boot time if the timer was missed, then do not enable the
>> mythfilldatabase.service.
>>
>>
>> The way to run cron jobs as different users is to change your command
>> prompt to that user:
>>
>> su -l mythtv
>>
>> and then run:
>>
>> crontab -e
>>
>> That puts you in your default command line editor (nano in my case) on
>> the crontab file for that user. Put your mythfilldatabase cron job
>> there, save and exit. Remove the anacron job from /etc/cron.daily or
>> wherever you currently have it.
>>
>> Note that user cron jobs are cron jobs, not anacron jobs. They are
>> run at the time specified only, and are not queued and run in sequence
>> with other jobs as cron.daily jobs are. And they do not get run
>> automatically at boot if the time was missed due to the PC being shut
>> down.
>>
>> My mythfilldatabase runs from my user crontab, as I have been running
>> it there since well before Ubuntu changed to systemd.
>> _______________________________________________
>
> I'm about to throw something!
>
> I've tried multiple cron settings, like you suggested, and get the same
> results. My normal user runs mythtv-setup, and has run mythfilldatabase
> for years just fine, until the change to the SD JSON grabber. I tried
> the systemd method as well, it gets the same error:
>
> tv_grab_zz_sdjson --capabilities failed or we timed out waiting...
>
> I've tried scripts running as other users, I've read and re-read both
> replies to my original message, as well as both wiki articles on xmltv
> and mythfilldatabase. Neither of them seem to make a difference.
> Everything runs fine when I run them manually, but as soon as cron is
> involved, it errors out and doesn't work.
>
> I copied all of the .mythtv and .xmltv directories to a newly created
> mythtv home directory, and again, it runs fine if I do so manually. But
> add it to cron, or your systemd suggestion, and it errors out the same
> way.
>
> I'm almost to the point of having another machine run a cronjob over ssh
> just to get it to work.
>
> I also tried sudo --set-home --login --user=mythtv ... but I guess I
> don't understand what the ... should be, as any command I use there does
> nothing and returns to the prompt.
>

By ..., I meant any MythTV command. For example, mythfilldatabase.
Or, at setup time, the tv_grab_zz_sdjson commands. That way the
command runs as user mythtv and you don't need extra files.

Actually, I recall you mentioning tv_grab_zz_sdjson_sqlite earlier.
You must choose one.

As to copying ~.mythtv/blah.xmltv and ~/.xmltv/SchedulesDirect.DB,
be sure the blah.xmltv file points to a single database. The one
under your user is fine. Just don't have two! And, the directories
must be writable by any user that attempts to change them.

Adjust as required if tv_grab_zz_sdjson is really being used.

--
Bill
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Mythfilldatabase [ In reply to ]
On Fri, 15 May 2020 17:21:50 -0400, you wrote:

>On Thu, May 14, 2020 at 03:19:31PM +1200, Stephen Worthington wrote:
>> On Wed, 13 May 2020 14:25:05 -0400, you wrote:
>>
>> >Just recently updated to mythtv 31.0 on Arch Linux. I moved the
>> >SchedulesDirect setup to tv_grab_zz_sdjson and am having a very strange
>> >thing happen which I can't figure out.
>> >
>> >If I run mythfilldatabase manually at the commandline, everything works
>> >perfectly. If I add it to a cron job, it fails with the following error:
>> >
>> >tv_grab_zz_sdjson --capabilities failed or we timed out waiting. You
>> >may need to upgrade your xmltv grabber
>> >
>> >Grabbing XMLTV data using tv_grab_zz_sdjson is not supported. You may
>> >need to upgrade to the latest version of XMLTV.
>> >
>> >Again, it works perfectly, as long as it isn't run from cron and I can't
>> >figure out why. Any suggestions?
>>
>> That sounds like the classic problem of cron running jobs as root, and
>> mythfilldatabase needs to be run from your mythtv user normally. If
>> you are any good at systemd, you might like to consider running
>> mythfilldatabase as a systemd timer unit - systemd makes it easy to
>> run things as different users.
>>
>> Here is what I think a systemd setup to run mythfilldatabase as the
>> mythtv user should look like. Note that I have not tested this:
>>
>> Create a file /etc/systemd/system/mythfilldatabase.service:
>>
>> [Unit]
>> Description=MythTV mythfilldatabase service.
>> Wants=mythtv-backend.service
>> After=mythtv-backend.service
>>
>> [Service]
>> User=mythtv
>> Group=mythtv
>> Type=simple
>> ExecStart=/usr/bin/mythfilldatabase
>>
>> [Install]
>> WantedBy=multi-user.target
>>
>> And then create a file /etc/systemd/system/mythfilldatabase.timer:
>>
>> [Unit]
>> Description=MythTV mythfilldatabase timer.
>>
>> [Timer]
>> OnCalendar=15:10:00
>> Persistent=true
>>
>> [Install]
>> WantedBy=timers.target
>>
>> Those files need to be chown root:root and chmod u=rw,g=r,u=r.
>>
>> Change the OnCalendar= setting to whenever you want mythfilldatabase
>> to be run. You can have as many OnCalendar= lines as you like.
>>
>> The do these commands:
>>
>> sudo systemctl daemon-reload
>> sudo systemctl enable mythfilldatabase.service
>> sudo systemctl enable mythfilldatabase.timer
>> sudo systemctl start mythfilldatabase.timer
>>
>> If you want to manually run mythfilldatabase:
>>
>> sudo systemctl start mythfilldatabase.service
>>
>> If you only want mythfilldatabase to be run at the time specified, and
>> not at boot time if the timer was missed, then do not enable the
>> mythfilldatabase.service.
>>
>>
>> The way to run cron jobs as different users is to change your command
>> prompt to that user:
>>
>> su -l mythtv
>>
>> and then run:
>>
>> crontab -e
>>
>> That puts you in your default command line editor (nano in my case) on
>> the crontab file for that user. Put your mythfilldatabase cron job
>> there, save and exit. Remove the anacron job from /etc/cron.daily or
>> wherever you currently have it.
>>
>> Note that user cron jobs are cron jobs, not anacron jobs. They are
>> run at the time specified only, and are not queued and run in sequence
>> with other jobs as cron.daily jobs are. And they do not get run
>> automatically at boot if the time was missed due to the PC being shut
>> down.
>>
>> My mythfilldatabase runs from my user crontab, as I have been running
>> it there since well before Ubuntu changed to systemd.
>> _______________________________________________
>
>I'm about to throw something!
>
>I've tried multiple cron settings, like you suggested, and get the same
>results. My normal user runs mythtv-setup, and has run mythfilldatabase
>for years just fine, until the change to the SD JSON grabber. I tried
>the systemd method as well, it gets the same error:
>
>tv_grab_zz_sdjson --capabilities failed or we timed out waiting...
>
>I've tried scripts running as other users, I've read and re-read both
>replies to my original message, as well as both wiki articles on xmltv
>and mythfilldatabase. Neither of them seem to make a difference.
>Everything runs fine when I run them manually, but as soon as cron is
>involved, it errors out and doesn't work.
>
>I copied all of the .mythtv and .xmltv directories to a newly created
>mythtv home directory, and again, it runs fine if I do so manually. But
>add it to cron, or your systemd suggestion, and it errors out the same
>way.
>
>I'm almost to the point of having another machine run a cronjob over ssh
>just to get it to work.
>
>I also tried sudo --set-home --login --user=mythtv ... but I guess I
>don't understand what the ... should be, as any command I use there does
>nothing and returns to the prompt.
>
>I'm stuck!

One other thing I did not mention about cron jobs and systemd services
is that they do not get the usual environment variables. Since those
variables often point to paths for things, that can be a problem. In
the wrapper script I have that runs my EPG collection from cron, I
have this:

# Set up a good environment for a cron job. This was created by
running the "at now + 1 hour" command on something, then going to the
# /var/spool/cron/atjobs directory and copying the resulting script,
then using "atrm" to remove the at job. The SSL/TTY bits were
removed.
umask 22
USER=stephen; export USER
LS_COLORS=rs=0:di=01\;34:ln=01\;36:hl=44\;37:pi=40\;33:so=01\;35:do=01\;35:bd=40\;33\;01:cd=40\;33\;01:or=40\;31\;01:su=37\;41:sg=30\;43:ca=30\;41:tw=30\;42:ow=34\;42:st=37\;44:ex=01\;32:\*.tar=01\;31:\*.tgz=01\;31:\*.arj=01\;31:\*.taz=01\;31:\*.lzh=01\;31:\*.lzma=01\;31:\*.zip=01\;31:\*.z=01\;31:\*.Z=01\;31:\*.dz=01\;31:\*.gz=01\;31:\*.bz2=01\;31:\*.bz=01\;31:\*.tbz2=01\;31:\*.tz=01\;31:\*.deb=01\;31:\*.rpm=01\;31:\*.jar=01\;31:\*.rar=01\;31:\*.ace=01\;31:\*.zoo=01\;31:\*.cpio=01\;31:\*.7z=01\;31:\*.rz=01\;31:\*.jpg=01\;35:\*.jpeg=01\;35:\*.gif=01\;35:\*.bmp=01\;35:\*.pbm=01\;35:\*.pgm=01\;35:\*.ppm=01\;35:\*.tga=01\;35:\*.xbm=01\;35:\*.xpm=01\;35:\*.tif=01\;35:\*.tiff=01\;35:\*.png=01\;35:\*.svg=01\;35:\*.svgz=01\;35:\*.mng=01\;35:\*.pcx=01\;35:\*.mov=01\;35:\*.mpg=01\;35:\*.mpeg=01\;35:\*.m2v=01\;35:\*.mkv=01\;35:\*.ogm=01\;35:\*.mp4=01\;35:\*.m4v=01\;35:\*.mp4v=01\;35:\*.vob=01\;35:\*.qt=01\;35:\*.nuv=01\;35:\*.wmv=01\;35:\*.asf=01\;35:\*.rm=01\;35:\*.rmvb=01\;35:\*.flc=01\;35:\*
.avi=01\;35:\*.fli=01\;35:\*.flv=01\;35:\*.gl=01\;35:\*.dl=01\;35:\*.xcf=01\;35:\*.xwd=01\;35:\*.yuv=01\;35:\*.axv=01\;35:\*.anx=01\;35:\*.ogv=01\;35:\*.ogx=01\;35:\*.aac=00\;36:\*.au=00\;36:\*.flac=00\;36:\*.mid=00\;36:\*.midi=00\;36:\*.mka=00\;36:\*.mp3=00\;36:\*.mpc=00\;36:\*.ogg=00\;36:\*.ra=00\;36:\*.wav=00\;36:\*.axa=00\;36:\*.oga=00\;36:\*.spx=00\;36:\*.xspf=00\;36:;
export LS_COLORS
MAIL=/var/mail/stephen; export MAIL
PATH=/home/stephen/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games;
export PATH
PWD=/home/stephen/.cron.daily; export PWD
LANG=en_NZ.UTF-8; export LANG
SHLVL=1; export SHLVL
HOME=/home/stephen; export HOME
LOGNAME=stephen; export LOGNAME
LESSOPEN=\|\ /usr/bin/lesspipe\ %s; export LESSOPEN
LESSCLOSE=/usr/bin/lesspipe\ %s\ %s; export LESSCLOSE
OLDPWD=/home/stephen/temp; export OLDPWD

The comment at the top shows how I got the settings necessary for
running a cron or systemd job. You can put the settings into a script
file, such as "epg.sh" and then run that from the cron or systemd job
that runs mythfilldatabase. So you then run mythfilldatabase from
epg.sh and run epg.sh from the cron or systemd job.

Also, run mythfilldatabase from where it works and look at its log
file to see what directory it is getting its configuration from. If
you can not find the log file, try adding "--logpath ." to the
mythfilldatabase command line to put the log file in the current
directory. Then look in the log for a line like this:

Using configuration directory = /home/stephen/.mythtv

I run mythfilldatabase from my mythfrontend user "stephen", rather
than from user "mythtv". But when mythfilldatabase is run by
mythbackend, it gets run using user "mythtv". So both those users
should have a config.xml file in their .mythtv directory. There can
be other files needed for each different XMLTV grabber. For example,
in my case I need a *.xmltv file for each video source. It is likely
that the mythfilldatabase log file will tell you each such file it
uses - my XMLTV grabber does that. If you have been running
mythfilldatabase manually from your mythfrontend user, it is likely
that both that user and the mythtv user will have those files, which
may be a problem. If you need to run mythfilldatabase manually as
well as from a cron/systemd job, then you should set up one user as
the place it gets run from, and in the other user's .mythtv directory,
use the "ln -s" command to link to the files needed under the other
user's directory. Make sure that the permissions are such that any
group "mythtv" user has full access to the files:

chown <local user name>:mythtv
chmod g+rw

or if it is a script or executable file or subdirectory:

chmod g+rwx

To run a script from a systemd job:

ExecStart=/bin/bash -c "/home/mythtv/bin/epg.sh"
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Mythfilldatabase [ In reply to ]
On Wed, May 13, 2020 at 1:26 PM Matthew Daubenspeck <matt@oddprocess.org>
wrote:

> Just recently updated to mythtv 31.0 on Arch Linux. I moved the
> SchedulesDirect setup to tv_grab_zz_sdjson and am having a very strange
> thing happen which I can't figure out.
>
> If I run mythfilldatabase manually at the commandline, everything works
> perfectly. If I add it to a cron job, it fails with the following error:
>
> tv_grab_zz_sdjson --capabilities failed or we timed out waiting. You
> may need to upgrade your xmltv grabber
>
> Grabbing XMLTV data using tv_grab_zz_sdjson is not supported. You may
> need to upgrade to the latest version of XMLTV.
>
> Again, it works perfectly, as long as it isn't run from cron and I can'tthe
> figure out why. Any suggestions?
>
> --
> Matthew Daubenspeck
> http://oddprocess.org
>
>
I also had this problem on Arch with the non-sqlite sdjson. My failure at
--capabilities was because the tv_grab_zz_sdjson from the xmltv package is
put in /usr/bin/vendor_perl,
which is not part of systemctl show-environment. I don't know why your cron
would fail, though.
I ended up creating a wrapper mfdb.sh to set PATH and start
mythfilldatabase, and then set the wrapper in mythtv-setup as the target.

Frank