Cannot find Perl local lib from crontab
#1
- operating system: Ubuntu 12.04
- get_iplayer version: 3.01 - manually installed following instructions in the wiki.
- problem: attempting to refresh cache from crontab produces the following error message:
Can't locate object method "name" via package "Mojo::UserAgent::Transactor" at /usr/local/bin/get_iplayer line 6771.

Here's the crontab entry:
15 * * * * /usr/local/bin/get_iplayer -v --type=radio --refresh > /home/alan/log-radio-gip.txt 2>&1
Output log is attached - it ends with the error message quoted above.

Running the identical command directly in the terminal runs properly and refreshes the cache without problem.

During installation I followed the wiki's instructions to create a local Perl module library at ~/perl5. I'm guessing that a command running from cron does not find this local library. How can I fix this?
Thanks,
Alan.



.txt   log-radio-gip.txt (Size: 1.52 KB / Downloads: 88)
#2
You would need to explicit load the relevant dot-file(s) in crontab, and perhaps explicitly set $SHELL. Google is your friend here. You could probably also simply add local lib to @INC directly: /usr/bin/perl -I$HOME/perl5/lib/perl5 /usr/local/bin/get_iplayer [...]
#3
perl -I solves the problem. Thank you for get_iplayer.
Alan.


Possibly Related Threads…
Thread Author Replies Views Last Post
  XML::Simple error, only when running via crontab NoOne 2 2,851 15-06-2015, 07:35 PM
Last Post: NoOne