runing sh script in cron job
Dear all,
I've created linux sh script that call perl script to backup database , the script is : #!/bin/bash cd /aptest/www/aptest/html/atm/bin perl exportAll.pl /AptestDB-Backup/"`date +%d%m%y`" >> /AptestDB-Backup/logs/"`date +%d%m%y`".txt the scrip run very well from shell , but when I call that script from cron job got this error : Your "cron" job on q-aptest /AptestDB-Backup/scripts/backup.sh produced the following output: Can't locate Archive/Zip.pm in @INC (@INC contains: /usr/perl5/5.8.4/lib/i86pc-solaris-64int /usr/perl5/5.8.4/lib /usr/perl5/site_perl/5.8.4/i86pc-solaris-64int /usr/perl5/site_perl/5.8.4 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.8.4/i86pc-solaris-64int /usr/perl5/vendor_perl/5.8.4 /usr/perl5/vendor_perl . /aptest/www/aptest/html/atm /aptest/www/aptest/html/atm/lib) at exportAll.pl line 95. BEGIN failed--compilation aborted at exportAll.pl line 95. can anyone help me to resolve this issue ? |
Looks like you are using some perl module and the path for that module is not present in @INC.
|
Cron runs with a minimalistic environment set up, this is by design.
If you need the $PATH environment variable to contain something specific, you will need to export it at the start of your script. Example: Code:
export PATH=$PATH:/my/directory |
I think the problem is not in the shell script, as the error suggested. The error suggest the problem is in exportAll.pl file.
emymcse please provide the full directory path of perl module in your code before using the zip.pm module FYI ... The @INC array is a list of directories Perl searches when attempting to load modules. To display the current contents of the @INC array: perl -e "print join(\"\n\", @INC);" |
All times are GMT -5. The time now is 02:41 AM. |