Re: cron problem

Gerald M Guglielmo <[email protected]>
Newsgroups gmane.org.user-groups.luni.tech
Message-ID <C95476E9.13CE5%[email protected]>
Hi,
  I am not familiar with Perl, but it sounds like the environment variable
Perl uses to find and include modules is the source of the trouble. Often
PATH can be an issue, but I have found that is an issue when you cannot find
an executable, not when you cannot import a module. I have seen this before
in Python with loading modules (don't recall what the env variable is
there). In C/C++ if I remember correctly the variable is LD_LIBRARY_PATH. A
few google hits suggest "export PERL5LIB=/home/uid/lib/perl5" if your
modules are in /home/uid/lib/perl5" and you are in a shell environment. I
also found that to add a variable to the crontab, you don't use the export
command, but otherwise the format is the same. For example, I have a crontab
which looks like this:

[email protected]
30 1 * * * /home/gug/autoStatsJob

So instead of MAILTO, you would put in PERL5LIB. And instead of my email
address, you need to put in your PERL5LIB path. Try locating where the
failing module is and use that. Also at the shell line see if PERL5LIB is
set by doing echo $PERL5LIB. If that is set, it may hold the answer.


On 1/13/11 8:12 AM, "Richard Reina" <[email protected]> wrote:

> Hello All,
> 
> Thanks much for the replies thus far. When I do:
> [root@tomsawyer richard]# env | PATH
> 
> I get:
> 
> PATH:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
> 
> Are you saying that I should put that exact line including the word PATH at
> the top of cron file like this?
> 
> PATH:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
> 1 9 * * 1 /usr/bin/perl /usr/local/src/scripts/inactive.pl
> 1 14 * * 1-6 /usr/bin/perl /usr/local/src/scripts/upcoming.pl
> 
>  
> 
> 
> ---- Linux Users Of Northern Illinois \(Chicago\) - Technical Discussion
> <[email protected]> wrote:
>> 
>> Ola,
>> 
>> On Wed, 2011-01-12 at 16:01 -0500, Richard Reina wrote:
>>> If I cut and paste the exact command from crontab -l and execute the
>>> prgram manually from the console I don't get this error.  I don't
>>> understand why cron has this problem?
>> 
>> It isn't a problem with cron. It's not finding something in your path
>> that it needs.
>> 
>> do this:
>> 
>> env | grep PATH
>> 
>> Take the line that gives you, and then add it to the top of the crontab
>> file.
>> 
>> Also, if you set the MAILTO variable in cron, you'll get the emails (or
>> whomever will) for it's output.
>> 
>> Here's what mine looks like:
>> 
>> 
>> PATH=/home/scott/bin:/opt/metasploit3/bin:/usr/local/sbin:/usr/local/bin:/usr
>> /sbin:/usr/bin:/sbin:/bin:/usr/games
>> [email protected]
>> 30 * * * * "/opt/metasploit3"/bin/msfupdate > /var/log/msfupdate.log 2>&1
>> 1 * * * * /usr/bin/svn update  /opt/metasploit3/msf3/ >>
>> /var/log/msfupdate.log 2>&1
>> *    *    *    *    *     cd /var/www; php -f cron.php > /dev/null 2>&1
>> 
>> 
>> -- 
>> W. Scott Lockwood III <[email protected]>
>> LRSE Hosting
>> 
>> -- 
>> Linux Users Of Northern Illinois (Chicago) - Technical Discussion
>> http://luni.org/mailman/listinfo/luni
>> 

-- 
-Jerry->
[email protected]
Pepe's Theory of everything: "Under the right circumstances, things happen."


-- 
Linux Users Of Northern Illinois (Chicago) - Technical Discussion 
http://luni.org/mailman/listinfo/luni
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.