Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi All
I put a perl program in my unix crontab. The program is suppose to read some arrays and print those array values into a file. When I run this program in the command prompt it works fine but when I am put in the crontab it runs and creates the file and the headers properly but it is not able to write the contents of the arrays into the file.
This is the crontab contents41 11 * * 3 perl_dir=/usr/local/bin/perl; export perl_dir; $perl_dir /opt/datafax/apps/excelfiles/DBStatus/WeeklyStatus.pl
I also use this other way of invoking the perl
41 11 * * 3 /usr/local/bin/perl /opt/datafax/apps/excelfiles/DBStatus/WeeklyStatus.pl
Please let me know how I can check the log files and other such details to make this program work completely not partially.
Is the way I invoke the this perl program in crontab wrong . This program takes more than a minute to execute so do I have to give a time range for it to complete execution.
Please let me know thanksRaha

use the 2nd form
what means "program work completely not partially."??using crontab:
man 5 crontab or
man -s 5 crontab

Typically problems like this occur because the shell started by cron doesn't inherit the same environment (ie PATH, etc) as the shell that you were using when you ran the program from the command line.
Two things to watch for:
1. Use full path names for every command. For example instead of:
cat file;
use:
/bin/cat file;
2. Make sure that any environment variables that you expect to be defined are actually defined. For example, you might be using $HOME, but it may not be defined in the shell started by cron

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |