pydsh

Pydsh is a Python-based replication of pdsh that uses sshreader as the engine for parallelizing ssh tasks. It also attempts to format the output from commands for you in a easy to read manner. Below are some examples of how it can be used.

Warning

With version 1.3 of pydsh I have moved away from uisng argparse in favor of the Click module. Some of the cli flags have changed.

Examples

Simplest form of pydsh [1]. Run a command and show the output of the commands as they complete: [2]

pydsh -w myhost[1-100].example.com 'uname -r'

Note

When using the --dshbak or coalesce options, a progress bar will be shown to the user as jobs are processing.

Run a script file rather than a simple command on remote hosts:

pydsh -F -w myhost[1-100].example.com my_complex_script.sh

Note

At this time scripts must have the first line start with #! in order to be loaded and run as a script by pydsh.

Print output organized by host (similar to piping to dshbak command):

pydsh -D -w myhost[1-100].example.com 'uname -r'

Print output coalesced by host (similar to piping to dshbak -c command):

pydsh -C -w myhost[1-100].example.com 'uname -r'

Override ssh with a username/password combo:

pydsh -u myuser -P Password1234 -w myhost[1-100].example.com 'uname -r'

Override ssh with a username/password combo (but prompt for the password):

pydsh -u myuser -p -w myhost[1-100].example.com 'uname -r'

Run pydsh faster: [3]

pydsh --redline -w myhost[1-100].example.com 'uname -r'

Indices and tables

[1]Pydsh supports hostlist expressions to make listing hosts easier.
[2]Output can be piped to dshbak command
[3]You may notice your fans spin up when using the redline option. This is normal.