0
|
1 |
'\" t
|
|
2 |
.\" CDDL HEADER START
|
|
3 |
.\"
|
|
4 |
.\" The contents of this file are subject to the terms of the
|
|
5 |
.\" Common Development and Distribution License (the "License").
|
|
6 |
.\" You may not use this file except in compliance with the License.
|
|
7 |
.\"
|
|
8 |
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
|
9 |
.\" or http://www.opensolaris.org/os/licensing.
|
|
10 |
.\" See the License for the specific language governing permissions
|
|
11 |
.\" and limitations under the License.
|
|
12 |
.\"
|
|
13 |
.\" When distributing Covered Code, include this CDDL HEADER in each
|
|
14 |
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
|
15 |
.\" If applicable, add the following below this CDDL HEADER, with the
|
|
16 |
.\" fields enclosed by brackets "[]" replaced with your own identifying
|
|
17 |
.\" information: Portions Copyright [yyyy] [name of copyright owner]
|
|
18 |
.\"
|
|
19 |
.\" CDDL HEADER END
|
|
20 |
.\"
|
11
|
21 |
.\" Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
0
|
22 |
.\" Use is subject to license terms.
|
|
23 |
.\"
|
11
|
24 |
.\" ident "@(#)pdsh.1 1.2 10/03/16 SMI"
|
0
|
25 |
.\"
|
|
26 |
.\"
|
|
27 |
\." $Id: pdsh.1.in 1177 2009-03-24 21:46:00Z grondo $
|
|
28 |
.TH "pdsh" "1" "solaris2.11" "pdsh-2.18"
|
|
29 |
|
|
30 |
.SH NAME
|
|
31 |
pdsh \- issue commands to groups of hosts in parallel
|
|
32 |
|
|
33 |
.SH SYNOPSIS
|
|
34 |
\fBpdsh\fR [\fIoptions\fR]... command
|
|
35 |
|
|
36 |
.SH DESCRIPTION
|
|
37 |
\fBpdsh\fR is a variant of the rsh(1) command. Unlike rsh(1), which runs
|
|
38 |
commands on a single remote host, \fBpdsh\fR can run multiple remote commands
|
|
39 |
in parallel. \fBpdsh\fR uses a "sliding window" (or \fIfanout\fR) of threads
|
|
40 |
to conserve resources on the initiating host while allowing some
|
|
41 |
connections to time out.
|
|
42 |
.LP
|
|
43 |
When \fBpdsh\fR receives SIGINT (ctrl-C), it lists the status of current
|
|
44 |
threads. A second SIGINT within one second terminates the program. Pending
|
|
45 |
threads may be canceled by issuing ctrl-Z within one second of ctrl-C.
|
|
46 |
Pending threads are those that have not yet been initiated, or are still
|
|
47 |
in the process of connecting to the remote host.
|
|
48 |
|
|
49 |
.LP
|
|
50 |
If a remote command is not specified on the command line, \fBpdsh\fR
|
|
51 |
runs interactively, prompting for commands and executing them when
|
|
52 |
terminated with a carriage return. In interactive mode, target nodes
|
|
53 |
that time out on the first command are not contacted for subsequent
|
|
54 |
commands, and commands prefixed with an exclamation point will be
|
|
55 |
executed on the local system.
|
|
56 |
.LP
|
|
57 |
The core functionality of \fBpdsh\fR may be supplemented by dynamically
|
|
58 |
loadable modules. The modules may provide a new connection protocol
|
|
59 |
(replacing the standard rcmd(3) protocol used by rsh(1)), filtering
|
|
60 |
options (e.g. removing hosts that are "down" from the target list),
|
|
61 |
and/or host selection options. By default, \fBpdsh\fR must have at least
|
|
62 |
one "rcmd" module loaded. See the \fBRCMD MODULES\fR section for more
|
|
63 |
information.
|
|
64 |
|
|
65 |
.SH "RCMD MODULES"
|
|
66 |
The method by which \fBpdsh\fR runs commands on remote hosts may be
|
|
67 |
selected at runtime using the \fI-R\fR option (See \fIOPTIONS\fR below).
|
|
68 |
This functionality is ultimately implemented via dynamically loadable
|
|
69 |
modules, and so the list of available options may be different
|
|
70 |
from installation to installation. A list of currently available rcmd
|
|
71 |
modules is printed when using any of the \fI-h\fR, \fI-V\fR, or \fI-L\fR
|
|
72 |
options. The default rcmd module will also be displayed with the
|
|
73 |
\fI-h\fR and \fI-V\fR options.
|
|
74 |
.LP
|
|
75 |
A list of \fIrcmd\fR modules currently distributed with \fBpdsh\fR
|
|
76 |
follows.
|
|
77 |
.TP 8
|
|
78 |
rsh
|
|
79 |
Uses an internal, thread-safe implementation of BSD rcmd(3)
|
|
80 |
to run commands using the standard rsh(1) protocol.
|
|
81 |
.TP
|
|
82 |
exec
|
|
83 |
Executes an arbitrary command for each target host. The first
|
|
84 |
of the \fBpdsh\fR remote arguments is the local command
|
|
85 |
to execute, followed by any further arguments. Some simple
|
|
86 |
parameters are substitued on the command line, including
|
|
87 |
\fI%h\fR for the target hostname, \fI%u\fR for the remote
|
|
88 |
username, and \fI%n\fR for the remote rank [0-n] (To get
|
|
89 |
a literal \fI%\fR use \fI%%\fR). For example,
|
|
90 |
the following would duplicate using the \fBssh\fR module to
|
|
91 |
run \fBhostname\fR(1) across the hosts foo[0-10]:
|
|
92 |
|
|
93 |
.nf
|
|
94 |
pdsh -R exec -w foo[0-10] ssh -x -l %u %h hostname
|
|
95 |
.fi
|
|
96 |
|
|
97 |
and this command line would run \fBgrep\fR(1) in parallel
|
|
98 |
across the files console.foo[0-10]:
|
|
99 |
|
|
100 |
.nf
|
|
101 |
pdsh -R exec -w foo[0-10] grep BUG console.%h
|
|
102 |
.fi
|
|
103 |
|
|
104 |
.TP
|
|
105 |
ssh
|
|
106 |
Uses a variant of popen(3) to run multiple copies of the ssh(1)
|
|
107 |
command.
|
|
108 |
|
|
109 |
.SH OPTIONS
|
|
110 |
The list of available options is determined at runtime
|
|
111 |
by supplementing the list of standard \fBpdsh\fR options with
|
|
112 |
any options provided by loaded \fIrcmd\fR and \fImisc\fR modules.
|
|
113 |
In some cases, options provided by modules may conflict with
|
|
114 |
each other. In these cases, the modules are incompatible and
|
|
115 |
the first module loaded wins.
|
|
116 |
|
|
117 |
.SH "Standard target nodelist options"
|
|
118 |
.TP
|
|
119 |
.I "-w [rcmd_type:][user@]host,host,..."
|
|
120 |
Target the specified list of hosts. Do not use with any other
|
|
121 |
node selection options (e.g. \fI\a\fR, \fI\-g\fR if they are
|
|
122 |
available). No spaces are allowed in the comma-separated list.
|
|
123 |
A list consisting of a single `-' character causes the target
|
|
124 |
hosts to be read from stdin, one per line. The host list may
|
|
125 |
contain hostlist expressions of the form ``host[1-5,7]''. For
|
|
126 |
more information about the hostlist format, see the
|
|
127 |
\fBHOSTLIST EXPRESSIONS\fR section below. A list of hosts
|
|
128 |
may also be preceded by "user@" to specify a remote username
|
|
129 |
other than the default, or "rcmd_type:" to specify an alternate
|
|
130 |
rcmd connection type for these hosts. When used together,
|
|
131 |
the rcmd type must be specified first, e.g. "ssh:user1@host0"
|
|
132 |
would use ssh to connect to host0 as user "user1."
|
|
133 |
.TP
|
|
134 |
.I "-x host,host,..."
|
|
135 |
Exclude the specified hosts. May be specified in conjunction with
|
|
136 |
other target node list options such as \fI\-g\fR (when available).
|
|
137 |
Hostlists may also be specified to the \fI\-x\fR option
|
|
138 |
(see the \fBHOSTLIST EXPRESSIONS\fR section below).
|
|
139 |
|
|
140 |
.SH "Standard pdsh options"
|
|
141 |
.TP
|
|
142 |
.I "-S"
|
|
143 |
Return the largest of the remote command return values.
|
|
144 |
.TP
|
|
145 |
.I "-h"
|
|
146 |
Output usage menu and quit. A list of available rcmd modules
|
|
147 |
will also be printed at the end of the usage message.
|
|
148 |
.TP
|
|
149 |
.I "-q"
|
|
150 |
List option values and the target nodelist and exit without action.
|
|
151 |
.TP
|
|
152 |
.I "-b"
|
|
153 |
Disable ctrl-C status feature so that a single ctrl-C kills parallel
|
|
154 |
job. (Batch Mode)
|
|
155 |
.TP
|
|
156 |
.I "-l user"
|
|
157 |
This option may be used to run remote commands as another user, subject to
|
|
158 |
authorization. For BSD rcmd, this means the invoking user and system must
|
|
159 |
be listed in the user\'s .rhosts file (even for root).
|
|
160 |
.TP
|
|
161 |
.I "-t seconds"
|
|
162 |
Set the connect timeout. Default is 10 seconds.
|
|
163 |
.TP
|
|
164 |
.I "-u seconds"
|
|
165 |
Set a limit on the amount of time a remote command is allowed to execute.
|
|
166 |
Default is no limit. See note in LIMITATIONS if using \fI-u\fR with ssh.
|
|
167 |
.TP
|
|
168 |
.I "-f number"
|
|
169 |
Set the maximum number of simultaneous remote commands to \fInumber\fR.
|
|
170 |
The default is 32.
|
|
171 |
.TP
|
|
172 |
.I "-R name"
|
|
173 |
Set rcmd module to \fIname\fR. This option may also be set via the
|
|
174 |
PDSH_RCMD_TYPE environment variable. A list of available rcmd
|
|
175 |
modules may be obtained via the \fI-h\fR, \fI-V\fR, or \fI-L\fR options.
|
|
176 |
The default will be listed with \fI-h\fR or \fI-V\fI.
|
|
177 |
.TP
|
|
178 |
.I "-L"
|
|
179 |
List info on all loaded \fBpdsh\fR modules and quit.
|
|
180 |
.TP
|
|
181 |
.I "-N"
|
|
182 |
Disable hostname: prefix on lines of output.
|
|
183 |
.TP
|
|
184 |
.I "-d"
|
|
185 |
Include more complete thread status when SIGINT is received, and display
|
|
186 |
connect and command time statistics on stderr when done.
|
|
187 |
.TP
|
|
188 |
.I "-V"
|
|
189 |
Output \fBpdsh\fR version information, along with list of currently
|
|
190 |
loaded modules, and exit.
|
|
191 |
|
|
192 |
.SH "ENVIRONMENT VARIABLES"
|
|
193 |
.PP
|
|
194 |
.TP
|
|
195 |
PDSH_RCMD_TYPE
|
|
196 |
Equivalent to the \fI-R\fR option, the value of this environment
|
|
197 |
variable will be used to set the default rcmd module for pdsh to
|
|
198 |
use (e.g. ssh, rsh).
|
|
199 |
.TP
|
|
200 |
PDSH_SSH_ARGS
|
|
201 |
Override the standard arguments that \fBpdsh\fR passes to the
|
|
202 |
ssh(1) command ("-2 -x").
|
|
203 |
.TP
|
|
204 |
PDSH_SSH_ARGS_APPEND
|
|
205 |
Append additional options to the ssh(1) command invoked by \fBpdsh\fR.
|
|
206 |
For example, PDSH_SSH_ARGS_APPEND="-q" would run ssh in quiet mode,
|
|
207 |
or "-v" would increase the verbosity of ssh.
|
|
208 |
.TP
|
|
209 |
WCOLL
|
|
210 |
If no other node selection option is used, the WCOLL environment
|
|
211 |
variable may be set to a filename from which a list of target
|
|
212 |
hosts will be read. The file should contain a list of hosts,
|
|
213 |
one per line (though each line may contain a hostlist expression.
|
|
214 |
See \fIHOSTLIST EXPRESSIONS\fR section below).
|
|
215 |
.TP
|
|
216 |
DSHPATH
|
|
217 |
If set, the path in DSHPATH will be used as the PATH for the
|
|
218 |
remote processes.
|
|
219 |
.TP
|
|
220 |
FANOUT
|
|
221 |
Set the \fBpdsh\fR fanout (See description of \fI-f\fR above).
|
|
222 |
|
|
223 |
.SH "HOSTLIST EXPRESSIONS"
|
|
224 |
As noted in sections above \fBpdsh\fR accepts lists of hosts the general
|
|
225 |
form: prefix[n-m,l-k,...], where n < m and l < k, etc., as an alternative
|
|
226 |
to explicit lists of hosts. This form should not be confused with regular
|
|
227 |
expression character classes (also denoted by ``[]''). For example, foo[19]
|
|
228 |
does not represent an expression matching foo1 or foo9, but rather
|
|
229 |
represents the degenerate hostlist: foo19.
|
|
230 |
|
|
231 |
The hostlist syntax is meant only as a convenience on clusters with a
|
|
232 |
"prefixNNN" naming convention and specification of ranges should not be
|
|
233 |
considered necessary -- this foo1,foo9 could be specified as such, or
|
|
234 |
by the hostlist foo[1,9].
|
|
235 |
|
|
236 |
Some examples of usage follow:
|
|
237 |
|
|
238 |
.nf
|
|
239 |
|
|
240 |
Run command on foo01,foo02,...,foo05
|
|
241 |
pdsh -w foo[01-05] command
|
|
242 |
|
|
243 |
Run command on foo7,foo9,foo10
|
|
244 |
pdsh -w foo[7,9-10] command
|
|
245 |
|
|
246 |
Run command on foo0,foo4,foo5
|
|
247 |
pdsh -w foo[0-5] -x foo[1-3] command
|
|
248 |
|
|
249 |
.fi
|
|
250 |
|
|
251 |
A suffix on the hostname is also supported:
|
|
252 |
|
|
253 |
.nf
|
|
254 |
|
|
255 |
Run command on foo0-eth0,foo1-eth0,foo2-eth0,foo3-eth0
|
|
256 |
pdsh -w foo[0-3]-eth0 command
|
|
257 |
|
|
258 |
.fi
|
|
259 |
|
|
260 |
As a reminder to the reader, some shells will interpret brackets ('['
|
|
261 |
and ']') for pattern matching. Depending on your shell, it may be
|
|
262 |
necessary to enclose ranged lists within quotes. For example, in
|
|
263 |
tcsh, the first example above should be executed as:
|
|
264 |
|
|
265 |
pdsh -w "foo[01-05]" command
|
|
266 |
|
|
267 |
.SH "ORIGIN"
|
|
268 |
Originally a rewrite of IBM dsh(1) by Jim Garlick <[email protected]>
|
|
269 |
on LLNL's ASCI Blue-Pacific IBM SP system. It is now used on Linux clusters
|
|
270 |
at LLNL.
|
|
271 |
|
|
272 |
.SH "LIMITATIONS"
|
|
273 |
.LP
|
|
274 |
When using \fBssh\fR for remote execution, expect the stderr of ssh to be
|
|
275 |
folded in with that of the remote command. When invoked by \fBpdsh\fR, it
|
|
276 |
is not possible for \fBssh\fR to prompt for passwords if RSA/DSA keys
|
|
277 |
are configured properly, etc.. For \fBssh\fR implementations that suppport
|
|
278 |
a connect timeout option, \fBpdsh\fR attempts to use that option to
|
|
279 |
enforce the timeout (e.g. -oConnectTimeout=T for OpenSSH), otherwise
|
|
280 |
connect timeouts are not supported when using \fBssh\fR. Finally, there
|
|
281 |
is no reliable way for \fBpdsh\fR to ensure that remote commands are
|
|
282 |
actually terminated when using a command timeout. Thus if \fI-u\fR is
|
|
283 |
used with \fBssh\fR commands may be left running on remote hosts even
|
|
284 |
after timeout has killed local \fBssh\fR processes.
|
|
285 |
|
|
286 |
The number of nodes that \fBpdsh\fR can simultaneously execute remote
|
|
287 |
jobs on is limited by the maximum number of threads that can be created
|
|
288 |
concurrently, as well as the availability of reserved ports in the rsh
|
|
289 |
rcmd modules. On systems that implement Posix threads, the limit
|
|
290 |
is typically defined by the constant PTHREADS_THREADS_MAX.
|
|
291 |
|
|
292 |
.SH "FILES"
|
|
293 |
|
|
294 |
.SH ATTRIBUTES
|
|
295 |
.sp
|
|
296 |
.LP
|
|
297 |
See \fBattributes\fR(5) for descriptions of the following attributes:
|
|
298 |
.sp
|
|
299 |
|
|
300 |
.sp
|
|
301 |
.TS
|
|
302 |
box;
|
|
303 |
cbp-1 | cbp-1
|
|
304 |
l | l .
|
|
305 |
ATTRIBUTE TYPE ATTRIBUTE VALUE
|
|
306 |
=
|
11
|
307 |
Availability shell/pdsh
|
0
|
308 |
=
|
|
309 |
Interface Stability Uncommitted
|
|
310 |
.TE
|
|
311 |
.SH "SEE ALSO"
|
|
312 |
rsh(1), ssh(1), dshbak(1), pdcp(1)
|
|
313 |
http://sourceforge.net/projects/pdsh/
|
|
314 |
.SH "NOTES"
|
|
315 |
Source for pdsh is available on http://opensolaris.org
|
|
316 |
|
|
317 |
|
|
318 |
|