AMG: This can and should be completely rewritten to use the new async package.
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 ^D [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, so 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. That's bad. On the other hand, if I didn't tell you about this problem, you'd probably never notice it--- how often do you run sort on remote hosts, anyway? Just be wary for the time being, and maybe someday this will be fixed.
Here's the TODO/ideas list. If you have any comments or implementation tips, write them here or email them to me (Andy Goth).
- Continue investigation of closing only stdin and leaving stdout/stderr open.
- Continue investigation of getting stderr text without closing the channel.
- Double-check that the standalone/sourced test is correct.
- Make reentrant by eliminating globals or creating "instances".
- Allow the caller to supply handlers for various events.
- Convert the [puts]s into default event handlers.
- Allow the caller to supply an alternate source for stdin data.
- Optionally return immediately and expose [node_wait] in some form.
- Be more configurable in general.
- Write a GUI frontend.
What: multissh Where: http://andy.junkdrome.org/devel/multissh/ Description: Program/package for simultaneously executing commands on multiple remote hosts. Version: 0.2 Updated: 27 October 2005 License: GPL 2.0 or later Contact: Andy Goth <[email protected]>