Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CRON Job

Status
Not open for further replies.
Mar 19, 2003
57
0
0
US
SC0 7.1

CRON schedules jobs correctly, except for one. Below is the problem entry. Also, below is the CRON log file. There is no problem executing this from the command line manually.


#Load Table
25 11 * * * sh /data/loaddata.sh

CMD: sh /data/loaddata.sh
> root 10904 c Tue Feb 1 11:05:00 2005
< root 10904 c Tue Feb 1 11:05:00 2005 rc=1
 
Does your loaddata.sh script rely on any environment variables, such as $PATH or $HOME? This is usually the main problem with cron and at jobs. Otherwise, post the code for loaddata.sh so we can look at it (if it's not too long).
 
Does your loaddata.sh script rely on any environment variables, such as $PATH or $HOME? This is usually the main problem with cron and at jobs. Otherwise, post the code for loaddata.sh so we can look at it (if it's not too long).
 
I may be talking rubbish here :)

but my cron jobs are not preceded by the shell they run in.

Are all your cron jobs like that ?

Alex
 
Does your loaddata.sh script rely on any environment variables, such as $PATH or $HOME? This is usually the main problem with cron and at jobs. Otherwise, post the code for loaddata.sh so we can look at it (if it's not too long).
 
sqlldr pro/pro control=/home/pro/dataload.ctl log=loadgood.log bad=loadbad.log
 
Hi Alexhu,

I tried it without the "sh" in front of it. I still get the same result. It doesn't run.
 
Usually the databases utilities need lot of environment variables.
Your loaddata script should populate them.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
You probably need to specify the full path to sqlldr and source your oraenv.
 
Oracle requires quite a few environment variables in order to run their utilities. They supply scripts to set these for you, oraenv and coraenv. "Sourcing" means to run them in the way appropriate for your shell so the environment variables they set are set in your shell rather than a subshell. i.e. ". oraenv" for bourne shell derivates or "source corenv" for csh derivs.

If you don't know where oraenv is, then you may try reading you login scripts or asking your DBA.
 
You must have somewhere a script setting all the necessary environment variables (check the oracle profile).
Your loaddata.sh script should script (dot command) this file to get a correct environment.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I added a call in my shell script to reference the profile file. I also, still had to add ksh to my CRON task schedule. If I didn't add ksh, it would not run. Weird.

. /etc/profile

Thanks everyone!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top