Hi All, I have found the solution. I need to write a line to top of my code and its works. use Lib "Path to your perl code"; then I can run this perl code directly from crontab I dont need a shell script to call the perl code.
Thanks Anirban Adhikary. On Tue, Mar 27, 2012 at 7:41 PM, Paul Johnson <p...@pjcj.net> wrote: > On Tue, Mar 27, 2012 at 04:30:27PM +0530, Anirban Adhikary wrote: > > Hi > > I need to run a perl script from cron tab. > > > > so I write a small shell script and call the perl script within that > shell > > script. > > /usr/bin/perl /home/anirban/perl_code.pl > > > > Before calling the perl script I copied all the contents of the .profile > > file and paste it within the shell script. > > > > But still the code is not running. > > cron problems are almost invariably due to environment or permissions > problems. You seem to have addressed the environment part, so my guess > would be permissions. > > The rest of the time the problem is to do with unescaped % characters. > > All this assuming the script works correctly outside of cron. > > Have you looked at the cron logs? > > The easiest way to debug further is probably to redirect stderr and > stdout to a file in your crontab entry and narrow down the problems that > way. This involves chaning the time the cronjob runs every time you > need to run a test, which is a real pain and seems like the sort of > thing for which there really should be a better solution. With luck, > someone will reply and say what that solution is. > > Good luck, > > -- > Paul Johnson - p...@pjcj.net > http://www.pjcj.net >