Linux – Parallel execution of different commands on multiple hosts

command-line-interfacelinuxssh

I'm looking for a tool for running a series of commands like the existing tool:

parallel -h
parallel [OPTIONS] command -- arguments
    for each argument, run command with argument, in parallel
parallel [OPTIONS] -- commands
    run specified commands in parallel

But I'd like these commands to be run over ssh on multiple computers, with some of the niceties of pssh or pdsh for communicating with many hosts. I've hacked out something that works,, but it's ssh handling is nothing compared to these tools – I can't stop them all, or even see all of their outputs.

Even better if the tool has some basic load balancing, but I was thinking I'd use a separate tool for host selection. (A good tool for querying load, memory, and if a computer is in interactive use would also be appreciated, but I've already written something that will suffice for host selection.) This isn't on a cluster, and I don't want to rely on daemons other than sshd, or ask admins to install a serious cluster job scheduler like Condor. I don't have root access on any of these computers.

Edit: To emphasize, I want to run different commands on each host – typically running the same program with different arguments, as in the first parallel usage example above.

Best Answer

Ah! It looks like the GNU version of parallel (not the one I had installed) does do this. No load balancing, and I haven't tried it out to see what it does with each stdout and stderr, but this is precisely what I wanted.

To run commands on more than one remote computer run:
seq 10 | parallel --sshlogin server.example.com,server2.example.net echo

Unfortunately I've written a script that gives status updates, has configurable output settings, and incorporates some simple load balancing, so I'll be sticking with it for now.