Problem while execution of second set of commands


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem while execution of second set of commands
# 1  
Old 06-15-2008
Problem while execution of second set of commands

Hi,
I have a shell script with code
. perf.env
cd $QRY_DIR
for SHELL_FILE in sql1
do
export SNAME=$SHELL_FILE
${SCRIPT_DIR}/perf_qry.sh ${SPOOL_DIR} ${DB_ENVNAME} ${NAME} &
RC=$(expr ${RC:-0} + $? )
sleep 60
if [ $RC == 0 ]
then
echo sysdate>test1
echo query1.txt>>test1
grep -i selected sql_test.txt>>test1
grep -i elapsed sql_test.txt>>test1
awk '/rows selected/ { $0=$1 } /Elapsed/ { split($2, t, ":");$0=3600*t[0]+60*t[1
]+'t[2]+.001*t[3]' }{ out=out sprintf("%s%s",NR==1?"":",","\047"$0"\047") }END{
print("insert into FDW_QUERY_TIME values ("out");") }' test1>test2
fi
done
exit $RC

My problem is after executing the sql1 and the spooling is completed I want to execute the next bit of code after sleep.I actually want to grep the spooled file items.but before spooling is completed the command are executed.
Can any one help me to correct this


Dont know the reason but my post has been duplicated..So this thread can be closed

Last edited by ran16; 06-15-2008 at 11:59 AM.. Reason: duplicated
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl execution commands

I don't know to debug the program todaylive.pl program. plz someone let me know what are the commands I need to know to debug the perl programs to find out the error on it. (3 Replies)
Discussion started by: ramkumar15
3 Replies

2. Shell Programming and Scripting

Execution of Shell Commands

I have a question: Where would I put the Command line (of any command) so that it executes every time I log on? Where would I put it if I want it to execute every time I start a new shell? (5 Replies)
Discussion started by: Nabeel Nazir
5 Replies

3. Shell Programming and Scripting

Sequential execution of commands in ksh

I need to run few commands in a ksh script sequentially. Some of the commands are jobs submitted to the server and the consecutive commands are dependent on the completion of the jobs submitted to the server. It works if i separate the commands into different files like this #!/bin/ksh... (1 Reply)
Discussion started by: prashob123
1 Replies

4. Shell Programming and Scripting

Execution problem unix commands in Perl CGI

I am trying to run SSH , mkdir and other unix commands using Perl CGI. But i am not able to Execute these commands. Please help me out !!!! SSH and mkdir is necessity for me. I will be thankful to you...!!!!! I am trying like: In perl CGI file i am writing like: @list = `ssh... (28 Replies)
Discussion started by: Navrattan Bansa
28 Replies

5. Shell Programming and Scripting

Execution problem with repeat the same program with two set of same data

I got a program named as "fastq_to_fasta". I got a long list of file all named as AB1 and AB2. My input file is : 071022_L1_AB1.fq 012121_L1_AB1.fq 021213_L1_AB1.fq 012153_L1_AB1.fq 071022_L1_AB2.fq 012121_L1_AB2.fq 021213_L1_AB2.fq 012153_L1_AB2.fq . . . . . . My desired... (10 Replies)
Discussion started by: patrick87
10 Replies

6. UNIX for Advanced & Expert Users

multiple commands execution

Hi i have 3 sql scripts that need to be executed simultaneously, and independent of one another, how do i do that in Unix AIX 5.3 (1 Reply)
Discussion started by: yschd
1 Replies

7. Shell Programming and Scripting

Problem while execution of second set of commands

Hi, I have a shell script with code . perf.env cd $QRY_DIR for SHELL_FILE in sql1 do export SNAME=$SHELL_FILE ${SCRIPT_DIR}/perf_qry.sh ${SPOOL_DIR} ${DB_ENVNAME} ${NAME} & RC=$(expr ${RC:-0} + $? ) sleep 60 if then echo sysdate>test1 echo query1.txt>>test1 grep -i... (6 Replies)
Discussion started by: ran16
6 Replies

8. Shell Programming and Scripting

echo just 1 line before execution/set +-x

Suppose that you want to mostly not echo commands inside your script during execution (e.g. to not bog the user down with details that they do not care about) but that there is the occaisional script line that you would like to echo before you execute it. Is there an elegant way to achieve this?... (3 Replies)
Discussion started by: fabulous2
3 Replies

9. UNIX for Dummies Questions & Answers

Set User ID on execution mode.

I have a directory. To this directory, for Group bits combination, it is showing as 's'. Which I found out, it means "Set User ID on execution mode". Within this directory I am not able to create subfolder. Does it mean, only the Owner of this directory will be able to create subdirectories &... (5 Replies)
Discussion started by: videsh77
5 Replies

10. UNIX for Dummies Questions & Answers

Question on Set User ID on Execution

I want group to run one of my unix script as me . I when the script is run it should have my permission's not the group . I tried this : 1.Have a file called y.ksh cat y.ksh echo $LOGNAME >ak_test 2.Output file has this permission -rwx------ ak_test 3.Then I chnaged... (7 Replies)
Discussion started by: akrathi
7 Replies
Login or Register to Ask a Question