0

I have a scenario:

My system has 2 servers: server_A and server_B

On server_A I create a shell script to execute commands on server_A and server_B by this flow:

  1. Run command1 on server_A and wait for completion.
  2. Run command2 on server_B and wait for completion.
  3. Run command3 on server_A and wait for completion.

(etc.)

Is there any good solutions for this case?

Thank you a lot.

2
  • You want to commands on alternating servers? Where do the commands come from? Will they be interactive, or are they static?
    – Kusalananda
    May 12, 2017 at 6:36
  • >You want to commands on alternating servers? Yes >Where do the commands come from? Using a shell script file on Server_A (or another server is ok) to execute commands on Server_A and B. >Will they be interactive, or are they static? They are static
    – Tuan Pham
    May 12, 2017 at 6:37

1 Answer 1

1

You can just make a script on server_A with :

command1

ssh server_B command2

command 3
2
  • But for each ssh command, server_B will ask server_A for the password to execute the command. How to skip this step? Thank you.
    – Tuan Pham
    May 12, 2017 at 7:50
  • 1
    @TuanPham ssh has a mechanism of key pair authentication, see for example : debian-administration.org/article/530/…
    – Esteban
    May 12, 2017 at 7:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .