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?
NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
3 replies Latest Post - 2004-05-18T08:22:35Z by SystemAdmin
Pinned topic cron job output
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2004-05-18T08:22:35Z at 2004-05-18T08:22:35Z by SystemAdmin
Re: cron job output2004-05-14T18:38:09Z in response to SystemAdmin> 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