Mailing List Archive

Script help please
Hi
I'm trying to run a script from crontab -e with

* * * * * /home/user1/cronping.sh
* * * * * /home/user1/mythlinks.sh

from the tab.

syslog shows each is being called each minute, however only cronping
seems to run.

mythlinks.sh is:
#!/bin/bash

/usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link
/var/www/mythlinks --format '%T/%T - %Y%m%d-%H%i -%S'
/usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link
/var/www/mythlinksall --format '%T - %Y%m%d-%H%i -%S'
/usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link
/var/www/mythlinksalldate --format '%Y%m%d-%H%i - %T -%S'

sudo /home/user1/mythlinks.sh runs fine.

I've been running mythlinks.sh here every minute for testing purposes,
but when its working I will knock it back to hourly.

What am I missing? How can I debug this further as mythlinks.sh won't
run from the crontab, which is what I am seeking.


_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Script help please [ In reply to ]
On Mon, 2014-01-06 at 18:45 +1300, tortise wrote:
> Hi
> I'm trying to run a script from crontab -e with
>
> * * * * * /home/user1/cronping.sh
> * * * * * /home/user1/mythlinks.sh
>
> from the tab.
>
> syslog shows each is being called each minute, however only cronping
> seems to run.
>
> mythlinks.sh is:
> #!/bin/bash
>
> /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link
> /var/www/mythlinks --format '%T/%T - %Y%m%d-%H%i -%S'
> /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link
> /var/www/mythlinksall --format '%T - %Y%m%d-%H%i -%S'
> /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link
> /var/www/mythlinksalldate --format '%Y%m%d-%H%i - %T -%S'
>
> sudo /home/user1/mythlinks.sh runs fine.
>
> I've been running mythlinks.sh here every minute for testing purposes,
> but when its working I will knock it back to hourly.
>
> What am I missing? How can I debug this further as mythlinks.sh won't
> run from the crontab, which is what I am seeking.
>
If it only runs with sudo, then it needs to be in the root cron, not
user1's which is where crontab -e will get you to. sudo crontab -e might
work? I'm a luddite and just log in as root so can't confirm or not.

hth,

Steve

--
Steve Holdoway BSc(Hons) MIITP
http://www.greengecko.co.nz
Linkedin: http://www.linkedin.com/in/steveholdoway
Skype: sholdowa


_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Script help please [ In reply to ]
On 6/01/2014 7:07 p.m., Steve Holdoway wrote:
> On Mon, 2014-01-06 at 18:45 +1300, tortise wrote:
>> Hi
>> I'm trying to run a script from crontab -e with
>>
>> * * * * * /home/user1/cronping.sh
>> * * * * * /home/user1/mythlinks.sh
>>
>> from the tab.
>>
>> syslog shows each is being called each minute, however only cronping
>> seems to run.
>>
>> mythlinks.sh is:
>> #!/bin/bash
>>
>> /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link
>> /var/www/mythlinks --format '%T/%T - %Y%m%d-%H%i -%S'
>> /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link
>> /var/www/mythlinksall --format '%T - %Y%m%d-%H%i -%S'
>> /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link
>> /var/www/mythlinksalldate --format '%Y%m%d-%H%i - %T -%S'
>>
>> sudo /home/user1/mythlinks.sh runs fine.
>>
>> I've been running mythlinks.sh here every minute for testing purposes,
>> but when its working I will knock it back to hourly.
>>
>> What am I missing? How can I debug this further as mythlinks.sh won't
>> run from the crontab, which is what I am seeking.
>>
> If it only runs with sudo, then it needs to be in the root cron, not
> user1's which is where crontab -e will get you to. sudo crontab -e might
> work? I'm a luddite and just log in as root so can't confirm or not.

Sorry I should have said I was running sudo crontab -e
crontab -e does get you to just the user1's crontab (its blank in terms
of active commands)
Also this is on mythbuntu 10.04. (The alternative approach is to upgrade
to 12.04 and see if the issue persists but debugging 10.04 seemed the
most expedient path...maybe...!?)


_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Script help please [ In reply to ]
On 6/01/2014 8:43 p.m., tortise wrote:
> On 6/01/2014 7:07 p.m., Steve Holdoway wrote:
>> On Mon, 2014-01-06 at 18:45 +1300, tortise wrote:
>>> Hi
>>> I'm trying to run a script from crontab -e with
>>>
>>> * * * * * /home/user1/cronping.sh
>>> * * * * * /home/user1/mythlinks.sh
>>>
>>> from the tab.
>>>
>>> syslog shows each is being called each minute, however only cronping
>>> seems to run.
>>>
>>> mythlinks.sh is:
>>> #!/bin/bash
>>>
>>> /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link
>>> /var/www/mythlinks --format '%T/%T - %Y%m%d-%H%i -%S'
>>> /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link
>>> /var/www/mythlinksall --format '%T - %Y%m%d-%H%i -%S'
>>> /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link
>>> /var/www/mythlinksalldate --format '%Y%m%d-%H%i - %T -%S'
>>>
>>> sudo /home/user1/mythlinks.sh runs fine.
>>>
>>> I've been running mythlinks.sh here every minute for testing purposes,
>>> but when its working I will knock it back to hourly.
>>>
>>> What am I missing? How can I debug this further as mythlinks.sh won't
>>> run from the crontab, which is what I am seeking.
>>>
>> If it only runs with sudo, then it needs to be in the root cron, not
>> user1's which is where crontab -e will get you to. sudo crontab -e might
>> work? I'm a luddite and just log in as root so can't confirm or not.
>
> Sorry I should have said I was running sudo crontab -e
> crontab -e does get you to just the user1's crontab (its blank in terms
> of active commands)
> Also this is on mythbuntu 10.04. (The alternative approach is to upgrade
> to 12.04 and see if the issue persists but debugging 10.04 seemed the
> most expedient path...maybe...!?)

Logging errors to a file I find repeated:

DBI
connect('database=mythconverg:host=localhost;port=3306','mythtv',...)
failed: Access denied for user 'mythtv'@'localhost' (using password:
YES) at /usr/share/perl5/MythTV.pm line 351
Cannot connect to database:

* * * * * mythtv /home/user1/mythlinks.sh does not work either....hmmm


_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Script help please [ In reply to ]
I've fixed this by
sudo cp /home/user1/.mythtv/config.xml /home/mythtv/.mythtv/
Thanks Steve et al.


_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Script help please [ In reply to ]
On Tue, Jan 7, 2014 at 12:01 AM, tortise <tortise@paradise.net.nz> wrote:
> I've fixed this by
> sudo cp /home/user1/.mythtv/config.xml /home/mythtv/.mythtv/
> Thanks Steve et al.

As an aside, there is no real need to run mythlink from cron, myth has
an events interface, so you can run it when a recording starts or
stops or whatever.


>
>
>
> _______________________________________________
> mythtvnz mailing list
> mythtvnz@lists.linuxnut.co.nz
> http://lists.ourshack.com/mailman/listinfo/mythtvnz
> Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/

_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Script help please [ In reply to ]
On 7/01/2014 7:12 p.m., Nick Rout wrote:
> On Tue, Jan 7, 2014 at 12:01 AM, tortise <tortise@paradise.net.nz> wrote:
>> I've fixed this by
>> sudo cp /home/user1/.mythtv/config.xml /home/mythtv/.mythtv/
>> Thanks Steve et al.
>
> As an aside, there is no real need to run mythlink from cron, myth has
> an events interface, so you can run it when a recording starts or
> stops or whatever.

I'm not sure it would be good to run the script concurrently say three
times when three recordings stop at the same time (as an example)?

I suppose the script could be revised to not run when its running but I
am not sure that really gains anything extra as I see no harm in it
running every hour, acknowledging that many times it would achieve
nothing, I suppose it could also be revised to run only if there is a
change....


_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Script help please [ In reply to ]
On 7/01/2014 11:55 PM, tortise wrote:
> On 7/01/2014 7:12 p.m., Nick Rout wrote:
>> As an aside, there is no real need to run mythlink from cron, myth has
>> an events interface, so you can run it when a recording starts or
>> stops or whatever.
>
> I'm not sure it would be good to run the script concurrently say three
> times when three recordings stop at the same time (as an example)?

I have mythlink.pl (rather than mythlinks.sh) configured as described at
http://www.mythtv.org/wiki/Mythlink.pl to run on recording start (can't
remember why I decided on recording start rather than end). Never
noticed any issues with it being run concurrently, I have it configured
to only create a symlink for the new recording so it doesn't replace all
symlinks every time.

I have a nightly cron job to tidy up old links (deleted recordings) but
I should clean up and move that to system events (delete, expire) as well.

> I suppose the script could be revised to not run when its running but
> I am not sure that really gains anything extra as I see no harm in it
> running every hour, acknowledging that many times it would achieve
> nothing, I suppose it could also be revised to run only if there is a
> change....

Well, if it works, it works.


_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
Re: Script help please [ In reply to ]
On Wed, Jan 8, 2014 at 10:26 AM, Adam Bennetts <abennetts@gmail.com> wrote:
> On 7/01/2014 11:55 PM, tortise wrote:
>>
>> On 7/01/2014 7:12 p.m., Nick Rout wrote:
>>>
>>> As an aside, there is no real need to run mythlink from cron, myth has
>>> an events interface, so you can run it when a recording starts or
>>> stops or whatever.
>>
>>
>> I'm not sure it would be good to run the script concurrently say three
>> times when three recordings stop at the same time (as an example)?
>
>
> I have mythlink.pl (rather than mythlinks.sh) configured as described at
> http://www.mythtv.org/wiki/Mythlink.pl to run on recording start (can't
> remember why I decided on recording start rather than end).

Start is the obvious time, the there is a link to in progress recordings,

> Never noticed
> any issues with it being run concurrently, I have it configured to only
> create a symlink for the new recording so it doesn't replace all symlinks
> every time.
>
> I have a nightly cron job to tidy up old links (deleted recordings) but I
> should clean up and move that to system events (delete, expire) as well.
>
>
>> I suppose the script could be revised to not run when its running but I am
>> not sure that really gains anything extra as I see no harm in it running
>> every hour, acknowledging that many times it would achieve nothing, I
>> suppose it could also be revised to run only if there is a change....
>
>
> Well, if it works, it works.
>
>
>
> _______________________________________________
> mythtvnz mailing list
> mythtvnz@lists.linuxnut.co.nz
> http://lists.ourshack.com/mailman/listinfo/mythtvnz
> Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/

_______________________________________________
mythtvnz mailing list
mythtvnz@lists.linuxnut.co.nz
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/