How can I automate running commands remotely over SSH to multiple servers in parallel?

前端 未结 20 1746
温柔的废话
温柔的废话 2020-12-12 20:03

I\'ve searched around a bit for similar questions, but other than running one command or perhaps a few command with items such as:

ssh user@host -t sudo su -         


        
20条回答
  •  猫巷女王i
    2020-12-12 20:29

    You can pipe the local script to the remote server and execute it with one command:

    ssh -t user@host 'sh' < path_to_script
    

    This can be further automated by using public key authentication and wrapping with scripts to perform parallel execution.

提交回复
热议问题