Script is not exiting from run mode.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script is not exiting from run mode.
# 1  
Old 04-09-2009
Script is not exiting from run mode.

Hi Folks.

My script is not exiting after run though its working correctly please suggest.

#!/bin/ksh
trap '' HUP

. /bin/functions
config_env
PATH=/bin:/usr/bin:/usr/local/bin:$EXEC_PATH:$ORACLE_HOME/bin
MONTH=$(control_register month)
YEAR=$(control_register year)
DATE_NOW="Job Started At $(date +'%Y/%m/%d %H:%M:%S')"
LOG_DIR=$LOG_PATH/$YEAR/$MONTH/refresh_backfeed
LOG_FILE=$LOG_DIR/refresh_backfeed.log
ORACLE_LOG_FILE=$LOG_DIR/IRISCOS_package.log
SQL_PACK="IRISCOS_REFRESH_pkg.IRISCOS"
if [[ ! -f $LOG_DIR/$LOG_FILE ]]
then
if [[ ! -d $LOG_DIR ]]
then
mkdir -p -m775 $LOG_DIR
print "creating $LOG_DIR" >>$LOG_FILE
fi
fi
echo " ${DATE_NOW} " > $LOG_FILE

# Run pack
run_sqlplus "exec $SQL_PACK "
EOF

DATE_NOW="$(date +'%Y/%m/%d %H:%M:%S')" >> $LOG_FILE
echo "job SUCCESS " >> $LOG_FILE
exit 0


After runing ./script_above runs the package not sure y its not exiting from the black screen need suggestions!
# 2  
Old 04-09-2009
I can't say for sure what is wrong, but I can make a guess based on a suspicious construct in the script.

Given this
run_sqlplus "exec $SQL_PACK "
EOF

It seems possible to me that the sqlplus is running, and reading standard in.
Nothing will change until it gets a *real* EOF, not the string "EOF" on the next line.

My guess is that it should have and empty "here-is" document like this:

run_sqlplus "exec $SQL_PACK " << EOF
EOF

The shell handles the "<< EOF" and puts <nothing> into the file which it attaches
to stdin for the run_sqlplus command. run_sqlplus will get an immediate end-of-file
when it reads stdin, and with luck, will exit and return control back to the script.


Also, you will lose the message "creating <log_dir>" from the log file because
echo " ${DATE_NOW} " > $LOG_FILE
does not use ">>"
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

how to run glance over ssh in batch mode

Hello; Is it possible to run glance over ssh in batch mode ?? Similar to running " top -f " command over ssh.. Need to get glance output for specific pids Thnx very much (5 Replies)
Discussion started by: delphys
5 Replies

2. Shell Programming and Scripting

how to run in background mode.

Hi All, i'm a newbie here, i'm just wondering in how do i run my script in background then echo it if it's done. Please advise, Thanks, -nik (1 Reply)
Discussion started by: nikki1200
1 Replies

3. Solaris

Single maintence mode cannot run any command on M4000

Hii All I was building two M4000 servers and one was successfully installed. Other one /usr has been unmounted. my putty session got disconnected and i connected to console where it asked for root single maintence # # init 0 not foung # df -h not found # xscf>poweroff -a xscf>... (8 Replies)
Discussion started by: seems
8 Replies

4. Shell Programming and Scripting

Run from waiting mode

I have no idea why this job has been put into waiting state by server. Can anyone help me to run this job from waiting state. ps -elf | grep 'usr_script' 4 S usr_script 3929 3926 0 77 0 - 2976 wait Oct21 ? 00:00:00 /bin/ksh /application_folder/script/report 0 S usr_script ... (2 Replies)
Discussion started by: zooby
2 Replies

5. Shell Programming and Scripting

Run a script in silent mode

Hi All, I have a script which calls some other scripts.. When i run the parent script all the status messages are displaying on terminal. I want to know how to suppress dem... or run a script in silent mode Thanks, Firestar (4 Replies)
Discussion started by: firestar
4 Replies

6. Shell Programming and Scripting

How to run VI in batch mode

Hi how do I use vi to do change some strings in a shell script loop 1. Run ls first, for each file that contains the word salesreport*.txt, do the following 2. use vi to run the following ex command : "1,$s/1975/1945/ig, wq" Please tell me how to do this in vi, not sed. Thank you. (5 Replies)
Discussion started by: grossgermany
5 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. Solaris

SFTP not exiting when run from cron

I am using a script to transfer a file from a unix host to another unix host. The code snippet for sftp in the script is as below. sftp -oIdentityFile=$ID_FILE_NAME -oNumberOfPasswordPrompts=0 $REMOTE_USERID@$REMOTE_HOST <<EOF cd incoming put $REPORT_FILE... (2 Replies)
Discussion started by: msabhilash
2 Replies

9. UNIX for Dummies Questions & Answers

How to run shell script in silent mode

Hi, I have a AIX shell script that normally runs in an interactive mode. Now there is a need to it in silent mode and take all default answers. How do I do that? Thanks. (3 Replies)
Discussion started by: x057373
3 Replies

10. Shell Programming and Scripting

run in debug mode

Hi, I have a question on my korn shell script. When I run without debugging turned on, I can't get the correct result. If I turn on the debug mode, like sh -x myprogram, it will give me the correct result. Can someone tell me what is going on here? Thanks, :rolleyes: (6 Replies)
Discussion started by: whatisthis
6 Replies
Login or Register to Ask a Question