Ubuntu: How can I run an application while another application is running? [duplicate]



Question:

This question already has an answer here:

I want to run an application when some other application is running. e.g. in a script I start an application:

#!/bin/sh  bob  

and this application will run for a large amount of time. However, I want to run another application alice (that will be using bob's results) 5 seconds after starting bob. How should I proceed?


Solution:1

Depending on how alice and bob are written and how fast each one runs, this might be as easy as:

#!/bin/sh  bob &  sleep 5  alice  

but that has these assumptions:

  • bob does not lock its output file(s) exclusively
  • bob runs faster then alice
  • alice does not need the full result set of bob to start executing.

If any of the above assumptions is not met, the solution is:

  1. Invent a time machine
  2. Go back in time a large enough amount of time
  3. Start bob
  4. Come back to current time + 5 seconds
  5. Start alice


Solution:2

and this application will run for a large amount of time. However, I want to run another application alice (that will be using bob's results) 5 seconds after starting bob.

This seems arbitrary. If you run bob | alice, then alice will start immediately processing output from bob. alice will process it as fast as bob can produce it.

What's your real question? What are you actually trying to accomplish? Without more details this question is not able to be answered.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »