UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old October 20th, 2003, 03:24 AM
kraghupa kraghupa is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 1 kraghupa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Unix Crontab

Hi
i have written a shell script which runs some sql queries in oracle.
the code looks like this

sqlplus username@NJCMTOMS/password < $HOME/devel/oms/arg/cleanupsql.sh

cleanupsql.sh has the sqls to be executed.

This works fine if i run from the prompt but when i run from a cron,then cron is not able to find sqlplus.i also tried giving the absolute path for sqlplus ,still no success.

Pls tell me what is the exact way of doing this.

Reply With Quote
  #2  
Old January 7th, 2004, 05:28 PM
chuck_meister chuck_meister is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Australia
Posts: 2 chuck_meister User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Similar problem

Hi

I've also got the same issue. I've created a ksh that uses sql+ to do select statements. It also works fine when executed from the prompt, but does not work when scheduled to run on cron.

The sql in my script is like this:

sqlplus -s USERNAME/PASSWORD@DATABASE <<END >$wsfile
set heading off
SELECT SQL QUERY HERE
/
END

I've tried adding the oracle home to the script but this still does not help.

Any assistance will be greatly appreciated.

Reply With Quote
  #3  
Old January 7th, 2004, 07:14 PM
chuck_meister chuck_meister is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Australia
Posts: 2 chuck_meister User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I found the solution.
I had to include:

export ORACLE_HOME=/ora/product/v9203

Also to define the full path for the sql path.

/ora/product/v9203/bin/sqlplus -s user/password@database

Reply With Quote
  #4  
Old January 12th, 2004, 09:19 AM
fpmurphy fpmurphy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: USA
Posts: 257 fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 23 h 46 sec
Reputation Power: 6
Whenever creating scripts run by cron, always

- include full paths to all necessary executables
i.e. /usr/bin/cat and so on.

- define all necessary environmental variables.
and export same.

Do not assume that cron runs the script in your
environment. It does not.

- Finnbarr

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Unix Crontab


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway