2
votes

my perl script is not executing in crontab,

I dont know how to confirm this but Im not seeing the script result or output.

But in the cron log I see a entry like Jul 28 12:35:01 dvsbi-build crond[13469]: (root) CMD (PATH=/usr/local/bin:/usr/sbin/usr/lib perl /dm2/www/html/isos/preFCS5.3/autodownload.pl)

And I set the cron job as

35 12 * * 2-6 PATH=/usr/local/bin:/usr/sbin/usr/lib perl /dm2/www/html/isos/preFCS5.3/autodownload.pl

Im not able to see the perl script result. In script I have redirected all the debug statements to a LOG file and I dont see the log file update.

the perl script run fine manually from anywhere in terminal by giving path like

perl /dm2/www/html....../autoDownload.pl 

Also I have given full path to the log files inside the script.

1
can you try and do "which perl" to see where it is located? is the PATH in the cron entry correct?sergio
why did you change the PATH since your last question? (stackoverflow.com/questions/6829648/confused-with-my-cron-job). At the least, you're missing a : between /usr/sbin and /usr/lib. Probably missing /usr/bin as a whole.PtPazuzu
Ok thanks everyone, I removed the PATH and just put perl /path/to/perl/script/script.pl and it worked, But I have no idea why it worked. Please let me know if you guys knowmac

1 Answers

7
votes

You should use the full path to perl in cron. Some implementations of cron restrict usage of environment variables.

Try to find out where perl is located on your system with which perl like sergio commented.

Given perl is in /usr/bin try the following:

35 12 * * 2-6 /usr/bin/perl /dm2/www/html/isos/preFCS5.3/autodownload.pl