Computing.Net > Forums > Unix > unix crontab

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

unix crontab

Reply to Message Icon

Name: raha
Date: April 7, 2004 at 09:12:42 Pacific
OS: sun solaris
CPU/Ram: pentium 4
Comment:

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 contents

41 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 thanks

Raha




Sponsored Link
Ads by Google

Response Number 1
Name: Dlonra
Date: April 7, 2004 at 15:35:53 Pacific
Reply:

use the 2nd form
what means "program work completely not partially."??

using crontab:
man 5 crontab or
man -s 5 crontab



0

Response Number 2
Name: Don Arnett
Date: April 8, 2004 at 09:33:54 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: unix crontab

UNIX Script Prob. www.computing.net/answers/unix/unix-script-prob/2039.html

deciphering the crontab www.computing.net/answers/unix/deciphering-the-crontab/605.html

unix scripting help needed. www.computing.net/answers/unix/unix-scripting-help-needed/2473.html