Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

The script I'm writing launches process A, which after an uncertain amount of time, launches a child process B.

I need the script to execute a command C which depends on process B. But B might not be there at call time!

How to wait until a process with a certain given name is spawned?

I reckon I could just blindly poll/wait inside an infinite loop but maybe there's a fancier solution...

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Does C run parallel to B, or after B? (series?)

If parallel, why not have B start C at same time (via a script?)

If series, then modify script A to add C after B.

share|improve this answer
    
Clever approach, I didn't think of wrapping commands -potentially not user-modificable, e.g. firefox- in scripts. –  vemv Jul 6 '12 at 12:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.