LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-09-2008, 12:40 AM   #1
nukeu666
Member
 
Registered: Mar 2004
Location: India
Distribution: MDK, Fedora, Debian Unstable (current)
Posts: 80

Rep: Reputation: 15
Script refuses to run section in '<<EOF'


A script does not run the part of my script in <<EOF/EOF

Code:
#!/bin/bash
/ora01/oracle/product/8.1.7/bin/sqlplus user@db/pwd<<EOF >>logfile
@/home/webops/null_process.sql
quit;
EOF

rest-of-script-runs-file
no logfile is made either
any ideas please?
 
Old 09-09-2008, 01:53 AM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
Here documents work fine :

Code:
$ cat foo.sh
#!/bin/bash

cat <<EOF >> output
line 1
line 2
line 3
EOF
[glacier:tmp] $ ./foo.sh
[glacier:tmp] $ cat output 
line 1
line 2
line 3
You haven't shown any evidence of a failure. Show how you actually invoke the script and any output.
 
Old 09-09-2008, 07:26 AM   #3
nukeu666
Member
 
Registered: Mar 2004
Location: India
Distribution: MDK, Fedora, Debian Unstable (current)
Posts: 80

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Mr. C. View Post
Here documents work fine :

Code:
$ cat foo.sh
#!/bin/bash

cat <<EOF >> output
line 1
line 2
line 3
EOF
[glacier:tmp] $ ./foo.sh
[glacier:tmp] $ cat output 
line 1
line 2
line 3
You haven't shown any evidence of a failure. Show how you actually invoke the script and any output.
when i run it by ./run.sh there there is no output given by sqlplus, nor does it execute the query (the @.... line)
 
Old 09-09-2008, 12:11 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 235Reputation: 235Reputation: 235
I think what you're script is actually trying to insert or run with the sqlplus command combined with EOF is: "@/home/webops/null_process.sql" and not the contents of the sql file itself.

You should be able to just do something like this to run the sql commands within the /home/webops/null_process.sql file:

Code:
cat /home/webops/null_process.sql | /ora01/oracle/product/8.1.7/bin/sqlplus user@db/pwd
 
Old 09-10-2008, 01:41 AM   #5
nukeu666
Member
 
Registered: Mar 2004
Location: India
Distribution: MDK, Fedora, Debian Unstable (current)
Posts: 80

Original Poster
Rep: Reputation: 15
thanks, that is a much cleaner way of donig it

but the original problem of cron not running the sqlplus line still persists.
running the script from prompt works fine
ill make a new thread for this problem since it seems to be a cron problem

Last edited by nukeu666; 09-10-2008 at 01:43 AM.
 
Old 09-10-2008, 10:29 AM   #6
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 235Reputation: 235Reputation: 235
Quote:
Originally Posted by nukeu666 View Post
thanks, that is a much cleaner way of donig it

but the original problem of cron not running the sqlplus line still persists.
running the script from prompt works fine
ill make a new thread for this problem since it seems to be a cron problem
What does your crontab look like for running it? No reason to start a new thread, keep the same ongoing discussions together.
 
Old 09-11-2008, 04:53 AM   #7
nukeu666
Member
 
Registered: Mar 2004
Location: India
Distribution: MDK, Fedora, Debian Unstable (current)
Posts: 80

Original Poster
Rep: Reputation: 15
ok..finally found that i had to export oracle environment variables to get sqlplus running

thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Gnome refuses to run devnull3d Linux - Desktop 2 07-30-2008 08:32 AM
Knetworkmanager-refuses to run soldier228 Linux - Software 5 06-25-2007 01:06 AM
500 EOF instead of reponse status line in perl script Sherlock Programming 7 05-16-2007 06:52 AM
xmms [looks like] refuses to run nadroj Linux - Newbie 9 04-04-2005 11:55 PM
Gimp crashes suddenly LibGimp-WARNING **: script-fu: wire_read: unexpected EOF anorman Linux - Software 0 03-12-2004 12:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration