linux - Shell programming: Executing two applications at the same time -


I have two applications, call them on APP1 and APP2. I would like them to run on my machine parallel It is not necessary that they start from the same time but should start at about the same time. One initial thought was a shell script that looks like this:

./ APP1 & amp; /. / APP2

Is this a trick or do I need to put it into the details of waiting for sure AP2 starts within a certain time frame?

Thanks

This could be better:

./ap1 & amp; ; ./app2 & amp;

But, as it has been said, the shell will start as child procedures in each of these sub-shells by opening any processes between startup or any synchronization between time Not guaranteed.

Why do you want them to run in parallel? Perhaps understanding this requirement will give you better answers.

You can create some very simple startup synchronization in two programs. The example "AP1" part here is here.

  #! / Bin / sh # app1.sh # Check any setup, open log file, resources etc., etc. ... sync -i timeout = 120 calculation = 0 touch / tmp / app 1 with other app typeSet while [[ ! -a / tmp / app2]]; If [[$ $ count -ge $ timeout]]; Then print-U2 "Exit: Wait for time off for AP2" to exit 1fi ((calculation = = 1)) at 1 a.m. # luggage is here ... #RM / TMP / AP1 exchange 0 Exit 0  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -