[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Crontab Perl



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> A client has a perl file they want to run at 8:00 am every morning.
> I have setup a crontab under the user and have verified it is
> functioning. However when the crontab attempts to run the perl
> (.pl) file it errors out. If I run it manually (either as the user
> or as root)... perl thefile.pl it runs fine without erroring (or so
> I am told).
>
> crontab file (ie schedule.cron)...
> 00 08 * * *    perl /path/to/schedule.cron
>
> the error in the cron log is...
> Can't locate BPE.pm in @INC (@INC contains:

Looks like they are calling a custom Perl module.  If they use the

use lib

pragma, they can specify the path to their module in the script 
itself.  Just put

use lib /path/to-BPE.pm;
use BPE;

at the top of the Perl script and it _should_ work...

i.e., if BPE.pm is in /home/sites/site7/users/somedude/, the script 
would start

#!/usr/bin/perl
use lib /home/sites/site7/users/somedude;
use BPE;


I'm not sure why the script works manually, though... if the path to 
BPE.pm isn't in the normal search path, it should die no matter 
what... something messy with the environment variables, I guess.

- -- 
Bruce Timberlake

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+NrHcvLA2hUZ9kgwRAqT8AJ9EtX5b6wJ7H/VcUsMag/0hiO1FLACeJMth
EXkSeD9skFDC42V4uZhfXPQ=
=UgPw
-----END PGP SIGNATURE-----