Version 4 of multissh

Updated 2005-10-28 02:37:04

AMG: As its name implies, multissh ssh'es to multiple hosts for the purpose of executing commands. This all by itself is a very trivial task, but the fun begins when you start to consider what to do with stdin, stdout, and stderr. multissh takes all input received on stdin and sends it to all remote hosts; all stdout and stderr text from the remote hosts is piped to the local stdout and stderr, with the hostname prepended.

New in version 0.2, multissh is also a Tcl package, consisting of a single command. I want you to guess what that command is named. As a package multissh is quite limited: basically if you're writing a Tcl script using multissh, you can call it as a command rather than [exec]'ing it, and that's all. But there is much potential; see the source for TODOs and ideas.


Perhaps an example will help. Here's a "screenshot":

 [root@utanium|~]# multissh "localhost bravo charlie" uptime
 localhost:  17:51:49 up  4:52,  2 users,  load average: 0.00, 0.00, 0.00
 bravo:  17:50:52 up  2:29,  1 user,  load average: 0.00, 0.00, 0.00
 charlie:  17:51:05 up  2:27,  1 user,  load average: 0.00, 0.00, 0.00
 [root@utanium|~]#

Well, there you have it. Now for stdin handling:

 [root@utanium|~]# multissh "localhost bravo charlie" "cat > file"
 illustrative verbiage
 [root@utanium|~]# multissh "localhost bravo charlie" "cat < file"
 localhost: illustrative verbiage
 bravo: illustrative verbiage
 charlie: illustrative verbiage
 [root@utanium|~]# multissh "localhost bravo charlie" "rm file"
 [root@utanium|~]#

Amazing, really. stderr works too:

 [root@utanium|~]# multissh "localhost bravo charlie" "rm file"
 localhost: rm: cannot remove `file': No such file or directory
 charlie: rm: cannot remove `file': No such file or directory
 bravo: rm: cannot remove `file': No such file or directory
 [root@utanium|~]#

Although not very well. :^) I don't get access to stderr until I [close] the ssh channels, all error messages are delayed until the session is closed.

There's a related problem. Some programs, for example sort, generate output after getting EOF on stdin. But Tcl doesn't support closing a child process channel's stdin and continuing to listen to its stdout/stderr, so it can never see any output that happens after stdin EOF.

Anyways, download your free copy today and have a lot of fun.


 What: multissh
 Where: http://ioioio.net/devel/multissh/
 Description: Runs commands on multiple remote hosts simultaneously.
 Version: 0.2
 Updated: 27 October 2005
 License: GPL 2.0 or later
 Contact: Andy Goth <[email protected]>

[ Category Application | Category Package ]