need to read a file and keep waiting till it satisfies some condition


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting need to read a file and keep waiting till it satisfies some condition
# 1  
Old 03-21-2006
need to read a file and keep waiting till it satisfies some condition

In my script i am writing to a counter file the no of processes i had started,
that is each time i start a process, i will increment the content of counter file and also when the process ends i will decrement the content of the file.

after this i do some other activities, by now i want to decide to execute further or wait till the processes i started earlier got over.

So i keep reading the counter file for till content becoming zero.
I am confused of writing the above part in script please help me writing a loop to keep reading the file till the contents become zero.

regards,
Senthil
# 2  
Old 03-22-2006
Since you didn't post your OS/version or even the shell you are using OR any of the script - one can only guess that this thread will help.
Specifically:
Code:
while [ $(( THREAD_CNT - 1 )) -gt 0 ]
            do
                update_process_status \
                     ${RUN_ID:-0} \
                     ${P_FN_CD} \
                     "InProgress" \
                     "staging ${FILE_TYPE} - sqlldr - threads still running: $(( THREAD_CNT - 1))" \
                     0
                sleep 2
                THREAD_CNT=$(ps -p $(print ${PID_LIST} | tr -d ' ' | nawk '{print substr($0,1,length($0)-1)}') | wc -l)
            done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read xml file till script finds separation and run again for next input and so on

Hi All, I have one query, I managed to run script with user inputs through command line or with 1 file. But I need to read a txt file/xml file in which user can mention multiple sets of answers and script should run for each set till it reach the EOF. Thanks in advance for example, the file... (3 Replies)
Discussion started by: rv_champ
3 Replies

2. Shell Programming and Scripting

Bash script to read a file from particular line till required line and process

Hi All, Am trying to write wrapper shell/bash script on a utility tool for which i need to pass 2 files as arugment to execute utility tool. Wraper script am trying is to do with above metion 2 files. utility tool accepts : a. userinfo file : which contains username b. item file : which... (2 Replies)
Discussion started by: Optimus81
2 Replies

3. Shell Programming and Scripting

If condition satisfies print the column header

Dear All, Good Day. I would like to solve the following issue and got some strange results, if anyone could help me in this regard, you are most welcome. Here is the problem: I have a file like Header Value1 Value2 Value3 Value4 Value5 Value6 ... Value9 12.144 6 5 ... (8 Replies)
Discussion started by: Fredrick
8 Replies

4. Shell Programming and Scripting

write a matrix element, if the "if" condition satisfies

Hi All, I would like to check a condition in a nxm matrix and if the condition satisfies then, I need to write the matrix element in the output file. For example, I have a matrix like this: 1 2 3 4 5 2 3 4 5 1 3 4 5 1 ... (8 Replies)
Discussion started by: Fredrick
8 Replies

5. UNIX for Dummies Questions & Answers

When reading a csv file, counter to read 20 lines and wait for minute then read next 20 till end

Hello All, i am a newbie and need some help when reading a csv file in a bourne shell script. I want to read 10 lines, then wait for a minute and then do a reading of another 10 lines and so on in the same way. I want to do this till the end of file. Any inputs are appreciated ... (3 Replies)
Discussion started by: victor.s
3 Replies

6. Shell Programming and Scripting

Waiting till the directory becomes empty

Hi Guys, I am writing a shell script to check whether the directory is empty or not. If it is empty then proceed but if it not then wait till it becomes empty. Is there any way for this? Suggestions are welcome!! Thanks in advance!:) (13 Replies)
Discussion started by: AB10
13 Replies

7. Shell Programming and Scripting

read file and print additional rows till current year

Hi all i have a file like 2006,1,2 2007,2,3 2008,3,4 I will read this and my output should be like 2006,1,2 2007,1,2 2008,1,2 2007,2,3 2008,2,3 2008,3,4 Giving the explanation, we will read the first line of the file and if the year any other than current year, we will print as many... (1 Reply)
Discussion started by: vasuarjula
1 Replies

8. UNIX for Dummies Questions & Answers

how to read a file till it encounters a blank line

Hi , I want to read a file starting with "*" up to till it encounters a blank line and to redirect this output to a different file.Plz suggest how to write a script for this. e.g:- * PK Sent Email (11.23) CALYPSO 1243215 9116457 NEW TRAD FAILED Nov 23 2007 9:34AM OASYS: DPS: SINGCORP invalid... (1 Reply)
Discussion started by: adityam
1 Replies

9. Shell Programming and Scripting

how to read a file till it encounters a blank line

Hi , I want to read a file starting with "*" up to till it encounters a blank line and to redirect this output to a different file.Plz suggest how to write a script for this. e.g:- * PK Sent Email (11.23) CALYPSO 1243215 9116457 NEW TRAD FAILED Nov 23 2007 9:34AM OASYS: DPS: SINGCORP invalid... (1 Reply)
Discussion started by: adityam
1 Replies

10. Post Here to Contact Site Administrators and Moderators

how to read a file till it encounters a blank line

Hi , I want to read a file starting with "*" up to till it encounters a blank line and to redirect this output to a different file.Plz suggest how to write a script for this. e.g:- * PK Sent Email (11.23) CALYPSO 1243215 9116457 NEW TRAD FAILED Nov 23 2007 9:34AM OASYS: DPS:... (0 Replies)
Discussion started by: adityam
0 Replies
Login or Register to Ask a Question