Logic Test Search Assistance


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Logic Test Search Assistance
# 1  
Old 10-21-2010
Logic Test Search Assistance

I need to create a logical test to see if a job is complete.
I have 4 seperate jobs that will be running in tandem and will create a file indicating the job completed. Once all 4 jobs have completed I will need to execute the final job to execute the final task. The problem I am having is that the 4 jobs may finish at different times, and the last task can not start until the original 4 jobs are completed. I have looked at possibly using a sleep command, but this seems somewhat inefficient. Can a scripting guru give me an idea of a best practice with an example of how to code something like this?

Thanks in advance
NoMadBanker(NMB)Smilie
# 2  
Old 10-21-2010
Are the jobs spawned by your current shell (ie are they children of the current process)?

If so you can ues the shells internal wait command. If not you may need to get their process id's and loop around waiting for each process to finish (eg test for /proc/<pid> directory or use "ps -p").
# 3  
Old 10-22-2010
I am expecting all the jobs to be kicked off by the single shell in tandem, but it needs to wait for all the jobs to finish bedfore moving onto the last step.

ie
login
>Execute all 4 jobs
>>wait for all 4 jobs to complete
>execute 5th job to commit/consolidate/report
exit
# 4  
Old 10-22-2010
Try to search the forum first, this is from 2 day's ago: Waiting for the background process to finish - The UNIX and Linux Forums
# 5  
Old 10-22-2010
Thanks,
I will try this and see if this creates the expected outcome I am looking for. Seem straight forward enough but I am certain I may have more questions.

Cheers
NMB
# 6  
Old 10-22-2010
Don't worry, I've seen exactly the same homework few times in the last weeks Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Search a multi-line shell command output and execute logic based on result

The following is a multi-line shell command example: $cargo build Compiling prawn v0.1.0 (/Users/ag/rust/prawn) error: failed to resolve: could not find `setup_panix` in `human_panic` --> src/main.rs:14:22 | 14 | human_panic::setup_panix!(); | ... (2 Replies)
Discussion started by: yogi
2 Replies

2. UNIX for Beginners Questions & Answers

Assistance required to decode sed search using /1

Hi, I am trying to extract line number (first number), as well as everything from TSVal onwards. 4 1.474005 172.18.124.142 -> 74.125.228.46 TCP 2450940617 74 44021 > https Seq=0 Win=5840 Len=0 MSS=1380 SACK_PERM=1 TSval=2450940617 TSecr=0 WS=64 6 1.488149 172.18.124.142 ->... (1 Reply)
Discussion started by: sand1234
1 Replies

3. Shell Programming and Scripting

Conduct a search or test -f over a path with spaces

I am organizing my music library on a NAS server. I want to print a list of all the directories that are missing the cover art (at least one or more jpeg file). I have successfully created a file with each line containing the path to each occurance of one or more .mp3 files. That path is also... (2 Replies)
Discussion started by: godfreydanials
2 Replies

4. Shell Programming and Scripting

Search a test file for specific words

I have the need to search a text file from my unix script to determine if it contains the strings of: 'ERROR' and/or 'WARNING'. By using Grep I can search the file and return a where one of these strings exists. Like this: cat myfile.txt | grep ERROR Output: PROCESS ERROR HERE ... (3 Replies)
Discussion started by: buechler66
3 Replies

5. Shell Programming and Scripting

sed search and replace word assistance...

Hi, I am trying to write a shell script designed to take input line by line by line from a file with a word on each line for editing with sed. Example file: 1.ejverything 2.bllown 3.maikling 4.manegement 5.existjing 6.systems My design currently takes input from the user, and... (2 Replies)
Discussion started by: mkfitzwilliams
2 Replies
Login or Register to Ask a Question