sshall

A simple but flexible tool for executing remote commands across multiple hosts


There are many excellent tools available for automating administrative tasks across many hosts.  However, these tools are usually quite sophisticated and require significant commitment and initial configuration overhead.  All I really wanted was a tool that would allow me to push command, using ssh, to large groups of hosts, often in parallel.  Also, I usually generated the list hosts I needed to work with using a pipeline of commands in bash.  These needs and insights led me to develop a tool that I call sshall that is designed to take a list of hosts from stdin and execute arbitrary commands across these hosts, optionally in parallel.  For example, consider the following usage:

$ echo bacon eggs waffles toast | sshall uptime

bacon
-------
 23:43:40 up 14 days,  5:05,  1 user,  load average: 1.19, 1.17, 1.15

eggs
-------
 23:40:23 up 14 days,  5:04,  4 users,  load average: 1.04, 1.00, 1.00

waffles
-------
 23:40:37 up 14 days,  5:08,  2 users,  load average: 1.38, 1.47, 1.51

toast
-------
 23:40:38 up 14 days,  5:08,  1 user,  load average: 0.10, 0.35, 0.69

From here, it is easy to imagine cases where you could use grep, awk, sed and so on build up the list of hosts you need to work with at any given time.

The initial version of sshall was written in bash but I soon began to want features that were more easily achieved in C.  The current C version of sshall is a work in progress but supports much of the functionality I am looking for, including:

  • sequential command execution
  • parallel command execution (in small batches or all at once)
  • color output, e.g., to denote a failure exit status
  • input from stdin or file

 

Download


The current C version of sshall is available for download on my github site and is provided with a permissive BSD-style license.  It should compile on just about any Linux system but please keep in mind that I have a fair bit of cleanup to do before its ready for prime time.

The older bash version of sshall, which is quite stable but lacks the more advanced features, is available for download here.