views:

48

answers:

2

I've got a shell script that runs genReport.sh in order to create a .pdf formatted report, and it works perfectly when it's run from the command line. The data source for the report is a ClearQuest database.

When it's run from a CRON job the .pdf file is created, except that only the various report and column headers are displayed, and the data of the report is missing. There are no errors reported to STDERR during the execution of the script.

This screams "environment variable" to me.

Currently, the shell script is defining the following:

CQ_HOME
BIRT_HOME
ODBCINI
ODBCINST
LD_LIBRARY_PATH

If it's an environmental thing, what part of the environment am I missing?

A: 

Without seeing the scripts, it's only guesswork. It could be a quoting issue or something having to do with a relative path to a file or executable that should be absolute. Often, the problem is that the directories listed in $PATH are different in cron's environment than they are in the user's. One thing you can do to aid in the diagnosis is add this line to your script:

env > /tmp/someoutputfilename.$$

and run the script from the command line and from cron and compare.

Dennis Williamson
A: 

The magic for making this run turned out to be evaluating the output of the clearquest -dumpsh command, which in turn required that the TZ variable be set. That command outputs a dozen or so variables.

Trueblood