how to automate timed running of 2 programs?
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.开发者_如何学Go. Is there a way to automate this ? i.e. is there any command or can any program be written to do this..
prog1 &
sleep 20
prog2
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
.
精彩评论