Question

I'm working in linux. I have two programs that run for infinite time ( that is , wont stop unless i kill the process ).i want to run program 1 first and then run program 2 after 20 seconds ( both will have to run simultaneously as one reads a file written by the other ).Currently , i am running the 2 programs by manually keeping track of time.. Is there a way to automate this ? i.e. is there any command or can any program be written to do this..

Was it helpful?

Solution

prog1 &
sleep 20
prog2

OTHER TIPS

Using the shell:

$ program1 & sleep 20 ; program2

If one program reads from the file output by the other you should consider using a pipe to pass output from one to the input of the other:

$> program1 | program2

I'm assuming that you have control over these two programs and can get them to write to stdout and read from stdin.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top