shell script exiting before completing


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shell script exiting before completing
# 1  
Old 07-02-2009
shell script exiting before completing

I have a script which has the following statement,

/opt/oracle/product/9i/bin/sqlplus << EOC >> $LOG_FILE 2>&1
username/password ---- Enters the SQL prompt
@/export/home/oracle/shells/grant_userview.sql ---Runs the SQL script
@/export/home/oracle/shells/grant_proc_userview.sql ---Runs the SQL script
@/export/home/oracle/shells/createindex.sql ---Runs the SQL script
exit --- Exits the SQL prompt
EOC

imp system/password file=/oradata/temp/user.dmp fromuser=user 1 touser=user2 indexes=y log=user.log -- Runs on $ prompt.

The statement in red above doesnt run. When run out of the script manually it succeeds, I am trying to figure if i have to move this "exit" below the last line, Please advice
# 2  
Old 07-02-2009
Does it produce an error?

(and what is the 1 between the fromuser and touser part)?
Code:
fromuser=user 1 touser=user2

Just as a thought: Is that imp command you show exactly the command you run from the script, or is the username/password, for example, in a variable? If so, did you export the varaible?

The exit isn't neccessary either in the SQL*Plus or the script. You should replace it with a / in the SQL.
# 3  
Old 07-02-2009
What happens if you add the full pathname to imp?
# 4  
Old 07-02-2009
Hi Scottn/fpmurhpy,

No there is no export of username/password required in the script because it contains the original username and password.

This script was running and since couple of days it terminates and doesnt run that imp command.

Thanks.
# 5  
Old 07-02-2009
What does user.log say?

Remove the exit anyway, as it's not required.
# 6  
Old 07-02-2009
file=/oradata/temp/user.dmp
is this file available in that location..
# 7  
Old 07-02-2009
Quote:
Originally Posted by welldone
[...]
This script was running and since couple of days it terminates and doesnt run that imp command.
If you enable tracing, you should be able to see what happens.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help with completing a bash script

Hello All, I am automating a task using bash script and got stuck at this. From the below input, Meta Device Members (20) : { ---------------------------------------------------------------------- BCV DATA RDF DATA ... (7 Replies)
Discussion started by: Sam R
7 Replies

2. Shell Programming and Scripting

Looping not completing in shell script

Hi, Iam using below code to login to servers to get cpu utilisation. but output is coming for only one server. code is below root@blr-svr-oclan-01 # more SSSC_CPU_UTIL1.sh #!/bin/sh echo "CPU UTILIZATION" while read line; do IDLE=`/usr/local/bin/sshpass -p 'xxx' ssh xxx@$line 'sar 2 2' |... (1 Reply)
Discussion started by: surender reddy
1 Replies

3. Shell Programming and Scripting

Exiting from Minicom on a shell script

This is what I've tried: #!/bin/sh send sh send showifs send exit ! killall minicom My problem is that for some reason when I do this it doesn't give me the results of the prior commands sent like showifs So I suspect my syntax is wrong. (1 Reply)
Discussion started by: uradunce
1 Replies

4. Solaris

Unable to install Sol10 on V245, exiting to shell.

Hi there, OK so I am super-green, but I have a problem I am hoping someone can help me with. I have a V245 that I am unable to install Solaris 10 (10/09) onto as during the initial install process, the UI pops up for region selection, but then as I enter my region, identify the system, up comes... (21 Replies)
Discussion started by: wallrunn3r
21 Replies

5. Shell Programming and Scripting

Exiting out of the script

I have to write a script in ksh which again should call another script. Say A.ksh is calling B.ksh. Now in B.ksh if the condition we are checking for is true then we have to go back to the main script A.ksh or if the condition in B.ksh is false then we have to totally come out of the scripts. I... (1 Reply)
Discussion started by: vpv0002
1 Replies

6. Shell Programming and Scripting

"Odd" behavior exiting shell script

Is it normal behavior for a shell script that terminates to terminate its parent shell when executed with the "." option? For example, if I have the example script (we'll name it ex.sh): #!/bin/sh if then echo "Bye." exit 2 fi And I execute it like this: >./ex.sh It... (6 Replies)
Discussion started by: DreamWarrior
6 Replies

7. Shell Programming and Scripting

exiting from script

Hi, I am trying to exit the script from a function. I was in assumption that if we use exit ( inside or outside the function) it will exit from the script. alternatively, return will exit from that particular function. but in my case, exit is exiting from the function and not the script.... (8 Replies)
Discussion started by: shellwell
8 Replies

8. Shell Programming and Scripting

Shell script..invoking command and exiting at fixed intervals

Hi, I need to write a shell script. Based on command line param to script say demode=yes Need to run an ant command for an hour(configurable) Then exit Again run the ant command all this needs to be in a loop. Thanks in advance Raj (1 Reply)
Discussion started by: rajuak12
1 Replies

9. Shell Programming and Scripting

Shell script not exiting Gracefully

Hi we are seeing strange behaviour , when we execute shell script it is successfully executing but it's PID is still hanging when we see ps -ef | grep script1.ksh until we do Kill <PID> $script1.ksh $ $ ps -ef | grep script1.ksh user1 249996 1 0 10:48:40 pts/1 0:00... (5 Replies)
Discussion started by: smithK
5 Replies

10. Shell Programming and Scripting

Terminate session on completing script

Hai all.. How do i terminate my telnet session automatically when my java applicatiion exits. i have a file run which executes my java application and takes care of all class and library path settings prior to the execution. I would like to terminate my session when my application exits. The... (4 Replies)
Discussion started by: deepsteptom
4 Replies
Login or Register to Ask a Question