[mythtv-users] myth_archive_job.pl fails as user job but works when run as mythtv user on CLI

Ian Evans dheianevans at gmail.com
Thu Nov 2 05:04:03 UTC 2023


On Wed, Nov 1, 2023 at 11:02 PM Stephen Worthington <
stephen_agent at jsw.gen.nz> wrote:

> On Wed, 1 Nov 2023 16:43:59 -0400, you wrote:
>
> >Running 33.1 fixes
> >
> >I'm running out of space until I get a new drive for the mythbox, so
> >mounted a windows share and set up a user job using the script at:
> >
> >https://www.mythtv.org/wiki/Myth_archive_job.pl
> >
> >I had used this in the past on another system and it worked. All it does
> is
> >move the recording file if there's enough space. I chose a recording and
> >selected the user job. It failed.
> >
> >The backend log:
> >Nov  1 14:40:46 bhmf mythbackend: mythbackend[210595]: E UserJob_920
> >jobqueue.cpp:2468 (DoUserJobThread) JobQueue: User Job '/usr/bin/
> >myth_archive_job.pl -d /media/disk2/mythtv -f 15709_20231031235900.ts"'
> >failed.
> >
> >When I ran /usr/bin/myth_archive_job.pl -d /media/disk2/mythtv -f
> >15709_20231031235900.ts from the command line as the mythtv user it
> worked.
> >
> >Any idea why it would fail as a user job? How can I get some more info on
> >why it failed?
> >
> >Thanks.
>
> User jobs get run by mythbackend, and so are run using the same user
> as mythbackend.  Jobs run from the command line are run as the user
> used to log on that command line.  So they are likely different users
> with different ownership and permissions on directories.  So what are
> the ownership and permissions on your archive directories?  Are they
> in the mythtv group?
>
> There is actually no need to run a script like Myth_archive_job.pl to
> move recording files - you can use any normal tool like mv from the
> command line or a GUI tool.  As long as you do it when MythTV is not
> in use (not recording or playing a recording and not within 1 minute
> of a recording start time), it is safe to move recording files.  You
> should have your archive directories in a storage group so that MythTV
> can still find the recordings in them - I just created a storage group
> called "Archives" and put mine in that.  Then as long as you do not
> have any recording rules that specifically say to record to any of the
> "Archives" directories, mythbackend will not record there but will
> find the files for playback and deletion.
>
> I have written myself a Python program (mythsqu) that has an option to
> fill up my "Archives" partitions from my recording partitions.  It
> moves the recordings oldest first, and monitors MythTV's state so it
> will pause whenever MythTV is busy.  Then when that has run (or when I
> have added a new or larger recording drive), I also run my
> balance_storage.sh script that moves recordings between my recording
> drives until they have roughly equal free space.  This is very useful
> when I replace an old 4 Tbyte drive with a new 20 Tbyte one, so that
> the free space is spread around and mythbackend will record evenly
> across my seven recording drives.  The balance_storage.sh script is
> older and only monitors MythTV's status for upcoming recordings - as
> soon as one is within 5 minutes it stops, so you need to run it again
> later when MythTV is idle again.
>
> http://www.jsw.gen.nz/mythtv/mythsgu
> http://www.jsw.gen.nz/mythtv/balance_storage.sh
>
> I would suggest that the simplest thing for you to do would be to wait
> for MythTV to be idle, then use a GUI file management program that can
> sort by timestamp to select the oldest files in each of your recording
> directories and move them to the Windows drive.  Then run
> balance_storage.sh.  When you get your new drive, you can just add it
> to your normal "Default" storage group and move all the files from the
> Windows drive over to it, then run balance_storage.sh again.
>

That's the weird part. The backend runs as mythtv, I ran the successful
command line test as the mythtv user. And the windows share is mounted as
mythtv owner and group. Per the wiki (
https://www.mythtv.org/wiki/Setup_Storage_Directories) the permissions are
2755.

I'll take your advice and check out your scripts. Thanks.

BTW,  you mentioned that you had 7 -recording- drives...what case are you
using?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20231102/33a3cb1b/attachment.htm>


More information about the mythtv-users mailing list