[mythtv-users] mythrename.pl fails when called from cron

Friedrich Clausen fred at derf.nl
Mon Nov 17 14:31:15 UTC 2008


On Mon, Nov 17, 2008 at 3:22 PM, OCG Technical Support <support at ocg.ca> wrote:
> My crontab is the standard:
> SHELL=/bin/bash
> PATH=/sbin:/bin:/usr/sbin:/usr/bin
> MAILTO=root
> HOME=/
>
> # run-parts
> 01 * * * * root run-parts /etc/cron.hourly
> 02 4 * * * root run-parts /etc/cron.daily
> 22 4 * * 0 root run-parts /etc/cron.weekly
> 42 4 1 * * root run-parts /etc/cron.monthly
>
>
> My script file is sitting in cron.daily

Ah, I see. Yes, you need to do it differently - try add the following
to /etc/crontab itself :

@daily mythtv /usr/local/bin/myscript.sh

Two notes about the above:

* Replace "mythtv" with the user you run mythtv as - usually mythtv.
* You will need to move your script out of /etc/cron.daily to another
location - for example /usr/local/bin or to the mythtv user's home
directory.

Then it may work as expected...

Cheers,

Fred.

>
> -----Original Message-----
> From: mythtv-users-bounces at mythtv.org
> [mailto:mythtv-users-bounces at mythtv.org] On Behalf Of Friedrich Clausen
> Sent: November 17, 2008 9:18 AM
> To: Myth TV Users List
> Subject: Re: [mythtv-users] mythrename.pl fails when called from cron
> Importance: High
>
> Hi,
>
> On Mon, Nov 17, 2008 at 3:15 PM, OCG Technical Support <support at ocg.ca>
> wrote:
>> I'm using the system /etc/crontab for my script.  I like the ease of use
> of
>> the system crontab...but it looks like this will always run as root (but
> the
>> error suggests otherwise).
>>
>> I'll look for an alternative...
>
> Can you paste your crontab line? I don't think you need to look for an
> alternative if that works for you. /etc/crontab is quite capable of
> running jobs as any user.
>
> Cheers,
>
> Fred.
>
>>
>> -----Original Message-----
>> From: mythtv-users-bounces at mythtv.org
>> [mailto:mythtv-users-bounces at mythtv.org] On Behalf Of Friedrich Clausen
>> Sent: November 17, 2008 9:05 AM
>> To: Myth TV Users List
>> Subject: Re: [mythtv-users] mythrename.pl fails when called from cron
>> Importance: High
>>
>> Hi,
>>
>> On Mon, Nov 17, 2008 at 2:55 PM, OCG Technical Support <support at ocg.ca>
>> wrote:
>>> I've got a cron job to create links to all of my recordings (for easy
>> access
>>> by Windows clients).  The script runs fine when run from the command
> line,
>>> but fails when cron runs it (with the error below).
>>>
>>>
>>>
>>> Judging from the error, it can't find config.xml (which exists under root
>>> and mythtv accounts).  Does cron run a job as no one?  Looking at the
>> error
>>> the script is looking into "//" which it won't find...
>>
>> It depends - cron will allow you to specify the user if you add the
>> job to a system-wide crontab, for example -
>>
>> * /etc/crontab
>> * /etc/cron.d/mycronjob
>> * /etc/cron.{hourly,daily,weekly}
>>
>> but you can also create cronjobs as a non-root user by executing
>> "crontab -e" as the user you wish to run the cronjob as. If you use
>> the "crontab -e" route then you don't need to specify a user to run
>> the job as.
>>
>> See: "man 5 crontab", "man 1 crontab" and "man cron" for more details.
>>
>> Cheers,
>>
>> Fred.
>>
>>>
>>>
>>>
>>> Thanks
>>>
>>> ----------------------
>>>
>>>
>>>
>>> No config found; attempting to find mythbackend via UPnP.
>>>
>>> No backends found.  Please copy //.mythtv/config.xml from a working
> MythTV
>>> installation instead.
>>>
>>> Compilation failed in require at
>>> /usr/src/mythtv-0.21-fixes/mythtv/contrib/mythrename.pl line 22.
>>>
>>> BEGIN failed--compilation aborted at
>>> /usr/src/mythtv-0.21-fixes/mythtv/contrib/mythrename.pl line 22.
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> mythtv-users mailing list
>>> mythtv-users at mythtv.org
>>> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>>>
>>>
>> _______________________________________________
>> mythtv-users mailing list
>> mythtv-users at mythtv.org
>> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>>
>> _______________________________________________
>> mythtv-users mailing list
>> mythtv-users at mythtv.org
>> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>


More information about the mythtv-users mailing list