Running two bash commands simultaneously on two different computers from the same script

I have a client and a host program (written in c) that I want to run from two different remote locations at the same time. Since I have to do this about 50 times to collect data, I do not want to run them separately. On the one hand, I need to log in via ssh, run a script and tell it to write the output to a file. Then I need to enter another block via ssh and tell him to send the data, and then repeat the whole process another 49 times.

I suppose what I need to do is run two commands from two separate windows.

How can I specify one bash script to create two windows, enter separate commands in each window and return to the parent window?

+3
source share
1 answer

If your client and host do not need terminals, you should be able to use them, especially if your output goes to a file.

ssh user@machine1 host_prog args > output file &
ssh user@machine2 client_prog args &
+2
source

Source: https://habr.com/ru/post/1732691/


All Articles