Bulk Linux Server Management Automation

One of the problems that techies who like to get their hands dirty with the nitty gritty of their server configuration and management is scaling the management of their Linux dedicated servers or VPSes (virtual private servers). To clarify, I am not referring to basic server management that comes included with most higher end server packages—I am referring to automation services that need to be done on a regular basis.

As an example, if you have 20 servers and on a regular basis, you need to bulk restart Apache, Exim, MySQL or the servers altogether, this method would save a ton of time in contrast to logging into each server individually using SSH and running these commands.

Here is how you would do it:

  1. Make sure you have PuTTY, and you can download it here (download putty.exe).
  2. In the same folder that you have putty.exe, create a .bat text file using Notepad in this case I am calling it servers.bat and create a .txt file using Notepad in this case I am calling it server_exec.txt
  3. Inside servers.bat, you want to put putty.exe root@server.com -pw password -m servers_exec.txt and repeat each server on a new line.
  4. Inside server_exec.txt, you want to put the SSH commands, one per line.
  5. Now, double click on servers.bat and it’ll login to each server and run your commands.

This concept can be taken and expanded on for more complex automation. For example, if each of your servers requires its own set of commands, you can create a separate .txt file for each server and update it in the corresponding line in your .bat file.