I have a cronjob which runs a script to retrieve a list of records from a table in the database.
When I run this shell script from the command line, then all works fine. I get the output file. But when I run this as a cron job, the output file always comes out as a blank.
I have tried running this as an 'at' job. The output comes out fine.
I have a command to run the db2profile script at the beginning of my file.
I am not sure why the difference in the two methods of running the same shell script. Could any one please thrown some light?
Re: cron job output2004-05-14T18:38:09ZThis is the accepted answer. This is the accepted answer.> I have a command to run the db2profile script at the beginning of my file.
make sure you do " . ~/sqllib/db2profile" and not actualy run the db2profile
please note the "dot" before the db2profile command, also redirect the
output (stdout and stderr) to a file, something like:
0 6 * * * /usr/local/mycommand > /tmp/mycommand.out 2>&1
Re: cron job output2004-05-18T08:22:35ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
That sorted the problem. Many thanks.