The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Read lines till a blank line is encountered saurabhsinha23 UNIX for Dummies Questions & Answers 1 12-19-2007 12:26 PM
how to read a file till it encounters a blank line adityam UNIX for Dummies Questions & Answers 1 11-25-2007 10:26 PM
how to read a file till it encounters a blank line adityam Shell Programming and Scripting 1 11-25-2007 10:15 PM
how to read a file till it encounters a blank line adityam Post Here to Contact Site Administrators and Moderators 0 11-25-2007 09:51 PM
Read file based on condition sbasetty Shell Programming and Scripting 5 01-31-2007 10:54 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-21-2006
Registered User
 

Join Date: Mar 2006
Posts: 16
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
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-21-2006
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
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
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:02 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0