Re: cron problem
Geoff Raye <[email protected]>
| Newsgroups | gmane.org.user-groups.luni.tech |
|---|---|
| Message-ID | <[email protected]> |
#<text/plain; charset=iso-8859-1 In message <[email protected]> Richard Reina writes: > Carl, > That was a very helpful idea. There is a message in my email that shows the error: > Can't locate Companies2.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at -e line 1. > BEGIN failed--compilation aborted at /usr/local/src/ldisplay.pl line 15. > Compilation failed in require at /usr/local/src/upcoming.pl line 71. > 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? Likely your environment as an interactive user has a setting which sets perl's path. Specifically to perl, you could add the actual path to @INC with... "use libs" and appropriate arguments, I think. I suspect your interactive shell loads via .profile or .bashrc or the like a PERL5LIB environment variable. Try to 'echo $PERL5LIB' and see if there's something there. If so, you could simply add to your cron command something like: PERL5LIB=/path/to/stuff:/more/perl/stuff /path/to/myscript.pl -a args In short, cron doesn't run all your normal shell initialization commands. You probably have something in your profile which cron isn't getting. Usually the place where this causes problems is having a path that's just "/bin:/usr/bin" and doesn't include "/usr/local/bin", for example. Another good thing to compare is the output of 'perl -V' from within cron and from your usual interactive shell. That will show the default contents of @INC. (For the non-perly out there, @INC is an array/list containing the paths where perl libraries/modules can be loaded from.) Geoff -- Linux Users Of Northern Illinois (Chicago) - Technical Discussion http://luni.org/mailman/listinfo/luni