Run the same script on several servers through SSH

Henrov

I regularly need to update some Ubuntu 12.04 (Precise Pangolin) servers (Rackspace).

What I do now is:

  • Copy a file to a server using SCP
  • Log on to the server using SSH
  • Stop Tomcat
  • Do some copying and moving of the uploaded file
  • Start Tomcat

Repeat the exact same process with the same file on the second server (12 servers now and the number is growing).

Is it possible to write a script that loops through a list of servers and does all this for me?

How would I go about it? Preferably the solution would not necesitate the install of any stuff. The majority within the company works on MacBooks, but Windows VM's are abundant.

Ideally servers to be updated can simply be added/removed to change the list of servers. However, any solution that saves me the time of doing the same thing +12 times is very much appreciated :)

John

There are several solutions for this - do you want to keep manual control of the steps and simply run through them simultaneously? The look at CSSH (if you're coming from a Linux system) or SuperPutty (if you're coming from a Windows system). If you simply want to automate everything, look at Expect.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Running the same command on several ssh servers using tmux

From Dev

How to create a script to run several scripts on different servers

From Dev

Isn't it conflict to run several SSH sessions with same port forwarding?

From Dev

ssh on multiple servers at the same time

From Dev

Perl - Run script remotely through SSH that includes a require directive

From Dev

Perl - Run script remotely through SSH that includes a require directive

From Dev

How to run a webserver script on remote server through SSH?

From Dev

How to run local bash script through multiple ssh

From Dev

I want to use parallel-ssh to run a bash script on multiple servers, but it simple prints the echo statements

From Dev

Access several SSH servers via a single jump SSH server

From Dev

Running sequential commands through ssh on multiple servers

From Dev

SSH Tunneling HTTPS traffic through 2 Servers

From Dev

Jenkins CI - Run SSH Deployment on Multiple servers

From Dev

Automatically run commands over SSH on many servers

From Dev

How to run ssh-agent and ssh-add through an SH script?

From Dev

Run script to ssh

From Dev

How to connect to multiple servers to run the same query?

From Dev

Run multiple servers in python at same time (Threading)

From Dev

How to run several times the same program with different inputs via Python script?

From Dev

Not able to run a command through ssh

From Dev

ssh to vagrant servers not posible when defining several servers in one vagrant file

From Dev

how to run my selenium script on multiple servers at the same time so that i would saved one by one execution time?

From Dev

How to run a local script with whitespace in arguments on a remote machine through multiple SSH?

From Dev

Run ruby files through script

From Dev

Run ruby script through vba

From Dev

Run ruby files through script

From Dev

SSH : Remotely run a script and stay there

From Dev

Run bash script upon ssh

From Dev

run command in script after an ssh

Related Related

  1. 1

    Running the same command on several ssh servers using tmux

  2. 2

    How to create a script to run several scripts on different servers

  3. 3

    Isn't it conflict to run several SSH sessions with same port forwarding?

  4. 4

    ssh on multiple servers at the same time

  5. 5

    Perl - Run script remotely through SSH that includes a require directive

  6. 6

    Perl - Run script remotely through SSH that includes a require directive

  7. 7

    How to run a webserver script on remote server through SSH?

  8. 8

    How to run local bash script through multiple ssh

  9. 9

    I want to use parallel-ssh to run a bash script on multiple servers, but it simple prints the echo statements

  10. 10

    Access several SSH servers via a single jump SSH server

  11. 11

    Running sequential commands through ssh on multiple servers

  12. 12

    SSH Tunneling HTTPS traffic through 2 Servers

  13. 13

    Jenkins CI - Run SSH Deployment on Multiple servers

  14. 14

    Automatically run commands over SSH on many servers

  15. 15

    How to run ssh-agent and ssh-add through an SH script?

  16. 16

    Run script to ssh

  17. 17

    How to connect to multiple servers to run the same query?

  18. 18

    Run multiple servers in python at same time (Threading)

  19. 19

    How to run several times the same program with different inputs via Python script?

  20. 20

    Not able to run a command through ssh

  21. 21

    ssh to vagrant servers not posible when defining several servers in one vagrant file

  22. 22

    how to run my selenium script on multiple servers at the same time so that i would saved one by one execution time?

  23. 23

    How to run a local script with whitespace in arguments on a remote machine through multiple SSH?

  24. 24

    Run ruby files through script

  25. 25

    Run ruby script through vba

  26. 26

    Run ruby files through script

  27. 27

    SSH : Remotely run a script and stay there

  28. 28

    Run bash script upon ssh

  29. 29

    run command in script after an ssh

HotTag

Archive