What's the error message? Errors will get e-mailed to the login name of the process running the cron job. Hopefully the shell script you are running is writing to a log for even more info. At any rate, the Oracle environment needs to be set inside the script itself. When you are running from the command line, your environment most likely already has ORACLE_HOME, ORACLE_SID, etc set in your .profile so it works fine from there. Set them at the top of your script and try it again.
How can I get the error messages for the cronjob ? My scripts begins with setup of Oracle Environment, so that's not a challenge, correct me if I am wrong. The output of the script file is written to another log file which is not generating by which I determined that cronjob is not working, but when I am running the script manually instead of cronjob, it is working fine. What other troubleshooting can I do under this scenario? Any advice /inputs will be highly appreciated.
Start by redirecting STDIN and STDOUT to some files in a directory writeable by you...
Cron has a log file, look in it for some information, on AIX and HP-UY you will find a /var/adm/cron directory with a log file... in RH5 I have no idea, somewhere in /var/log?
Then as Gary mentionned, you should have a message in your mbox about cron - What does it say?
I don't know which is the default Shell for cron jobs in Redhat 5.
If it is not the same as the Shell in your interactive account, then you will need a Shebang line on the first line of the script to cause it to execute with the correct Shell.
Yes it is the same script as in my last thread. One interesting note that I created the cron job s from my Oracle user, will I try to create the same cron job from root user and see the result? What's your opinion?
First, let's take a proper look at the root mailbox.
Read the file with more and search for the name of your script.
I suspect that you will see syntax errors for the "export" lines because your Shell in cron is not suitable for your script, or maybe some other error?
If it's not in the root mailbox, try the oracle mailbox. The cron log however suggested that the job failed before cron had a chance to change the user to oracle.
If you create the job as a root cron, the crontab line will need a "su oracle" (or whatever is appropriate in Red Hat). There is no real advantage to doing this.
Permissions on the script might be wrong?
What's the output from: