[thor@updraft ~/Programs]$ perl -v
This is perl, v5.10.0 built for i686-linux
I tested two crontabs.
1. has-download-0.1.pl: returned the same error above. 2. perl has-download-0.1.pl: returned the same error above.
This program runs fine just typing perl has-download-0.1.pl into a terminal. Not sure how to change the variable so that it is visible to cron.
I also tried running the script in the background using: #!/bin/csh
at now << EOF
./has-download-0.1.pl
EOF
exit
and received this in my mail:Can't locate Mail/Box/Manager.pm in @INC
| [reply] [d/l] [select] |
Its definitely true that cron is using perl5.8.8 to execute my scripts. This is verified by the output:
root@updraft thor]# perl5.8.8 -V
@INC:
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8
/usr/lib/perl5/site_perl/5.8.7
/usr/lib/perl5/site_perl/5.8.6
/usr/lib/perl5/site_perl/5.8.5
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.8
/usr/lib/perl5/vendor_perl/5.8.7
/usr/lib/perl5/vendor_perl/5.8.6
/usr/lib/perl5/vendor_perl/5.8.5
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/5.8.8
Guess I'm going to have to do some research into why cron is using the old command perl5.8.8 and not the new one perl. | [reply] [d/l] |
So... it must be the case that /usr/bin/perl on the machine where this cron job is running happens to be 5.8.8, because your script has /usr/bin/perl on the shebang line, and that is what cron must be running.
Are you doing your interactive shell testing on a different machine? Or is your interactive shell environment set up such that /usr/bin/perl is somehow superseded in your PATH by a 5.10 installation? (and/or you have PERL5LIB initialized in some way that doesn't carry over into cron jobs)
Anyway, if it's true that perl 5.10 exists somewhere on the machine where cron is running, and that the module in question has been installed for that instance of perl 5.10, and you actually want to use 5.10, and you can find the path to that instance (e.g. do type perl in your shell), then just put that path as the shebang line in the script.
Update: actually, I'm not sure I'm convinced by the diagnostics you've shown so far. Did you really try a cron job that just did "/usr/bin/perl -V" ? If not, do that first. Then, if it really is 5.8.8, just change the shebang line to get 5.10 instead.
If /usr/bin/perl is already 5.10, now it's a question of making sure you know where the module is, or maybe just making sure it gets installed in the "normal" way (with root permission, under /usr). If it's in some path not covered by the default @INC, and you want to use that, just add something like this to your script:
use lib '/offbeat/path/for/misc_modules';
| [reply] [d/l] [select] |
Where is Perl 5.10 installed and where is 5.8.8 installed?
Assuming that 5.10 is installed in /usr/bin/perl try this in the crontab file:
/usr/bin/perl has-download-0.1.pl
| [reply] [d/l] |