Looping with wait in UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Looping with wait in UNIX
# 1  
Old 07-17-2013
Looping with wait in UNIX

Hello Gurus ,

Could you help me with my below requirement

In my script I will start a process ,it takes some time to complete the process.After completion it will create a file
after that I have to restart the process again
The number of time it will be done will vary but that count we should know before

so here is the algorithm

for in 1...count

delete indicator file

step 1 start process
step 2 check indicator file exist [ denotes process completed ]
no then sleep for 30 second
go to step 2
else
go to step 1 [run the process again ]

do this until the for loop completed

Could anyone please give me the code or suggestion how to procees
Your help is very much appreciated
# 2  
Old 07-17-2013
Is this a homework assignment? If not, please explain what is going on here.
# 3  
Old 07-17-2013
No Don its not

We have to run informatica (an ETL tool) workflow from the unix script
Now the unix command will start the workflow but will never know whether its finished that process or not .

It may took 5 mins to 1 hours depending on the load to complete the workflow .

Now we have to run the workflow depending on the number of trigger files in a directory so we have to start the informatica workflow in a loop.

Thats why we have the above approach .
take the count of the number of trigger files
start the workflow (workflow will create a indicator file after its successful completion)
check about the indicator file if its there means the workflow finished then again start it after deleting the workflow

Else wait to finish the workflow

Does it make sense?
# 4  
Old 07-17-2013
Why count the trigger files? Can't you use them directly?

Where are they stored? What are they named?
# 5  
Old 07-17-2013
After well over 100 posts and having received our help in solving more than 50 issues you have submitted, please show us what you have tried so far.

Have you considered changing the UNIX command that starts the workflow so it does know when the workflow completes and whether or not it completes successfully?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Looping through records in db and processing them in UNIX

Hi, I want to read multiple records from oracle database table and then based on each record I need to do some file modifications in UNIX. I'm not sure how do I process each record from DB in UNIX.Below is the code snippet. sqlplus user/pwd@DEV for i IN (select * from table) loop -- for... (2 Replies)
Discussion started by: prats_7678
2 Replies

2. UNIX for Dummies Questions & Answers

Call a UNIX script inside another and dont wait for it

Hi I have two scripts script1.sh and script2.sh(say this script is a long running). I want to call script2.sh inside and script1.sh,but when i call script2.sh i dont want to wait for script2 to complete and want this to run in back ground and go on next commands in script 1.sh and finally at the... (2 Replies)
Discussion started by: lijjumathew
2 Replies

3. Shell Programming and Scripting

calling a shell script in background and wait using "wait" in while loop

Hi, I am facing a strange issue, when i call a script from my while loop in background it doesnt go in background, despite the wait i put below the whil loop it goes forward even before the process put in background is completed. cat abc.txt | while read -u4 line do #if line contains #... (2 Replies)
Discussion started by: mihirvora16
2 Replies

4. Shell Programming and Scripting

wait example

Hi Gurus, Some questions regarding wait. I have tried searching in this forum for threads on wait but not completely got what I am looking for. Background: One script (.sh) that starts/calls a reference to an application's executable and submits a batch job to it. Objective is to wait... (2 Replies)
Discussion started by: rsheikh
2 Replies

5. Red Hat

WAIT

Can someone explain what is the status says WAIT on performance monitoring command.. (2 Replies)
Discussion started by: suresh_krish
2 Replies

6. Shell Programming and Scripting

How to use looping in unix

Can someone help me coding a loop (like for loop in C)? I mean what is the syntax....? My requirement is, i have to send every successive string searched using awk to a csv file till the end of the file..Please help. (1 Reply)
Discussion started by: goutam_igate
1 Replies

7. Shell Programming and Scripting

wait command - cat it wait for not-chile process?

Did not use 'wait' yet. How I understand by now the wait works only for child processes, started background. Is there any other way to watch completion of any, not related process (at least, a process, owned by the same user?) I need to start a background process, witch will be waiting... (2 Replies)
Discussion started by: alex_5161
2 Replies

8. Shell Programming and Scripting

wait ${!}

In one of the shell script (Where abinitio graph is called), the last line is wait ${!}. What does this wait ${!} mean ??? (2 Replies)
Discussion started by: risshanth
2 Replies

9. UNIX for Dummies Questions & Answers

About wait

Hi everyone I'm novice at Unix programming and I hope to post this thread in the correct place. I have the following doubts: 1 Suppose we have some processes which are B's children process and another process A which has no relation with B and its children. Can A do wait () for a... (5 Replies)
Discussion started by: Puntino
5 Replies

10. Shell Programming and Scripting

Need to execute 2 scripts, wait, execute 2 more wait, till end of file

:cool: I need to execute a shell script to do the following: cat a file run two back ground processes using the first two values from the file wait till those background processes finish run two more background processes using the next two values from the file wait till those background... (1 Reply)
Discussion started by: halo98
1 Replies
Login or Register to Ask a Question