Debian Codegraph @

doc/man/man1/clush.1

raw
1 .\" Man page generated from reStructuredText.
2 .
3 .
4 .nr rst2man-indent-level 0
5 .
6 .de1 rstReportMargin
7 \\$1 \\n[an-margin]
8 level \\n[rst2man-indent-level]
9 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
10 -
11 \\n[rst2man-indent0]
12 \\n[rst2man-indent1]
13 \\n[rst2man-indent2]
14 ..
15 .de1 INDENT
16 .\" .rstReportMargin pre:
17 . RS \\$1
18 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
19 . nr rst2man-indent-level +1
20 .\" .rstReportMargin post:
21 ..
22 .de UNINDENT
23 . RE
24 .\" indent \\n[an-margin]
25 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
26 .nr rst2man-indent-level -1
27 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
28 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
29 ..
30 .TH "CLUSH" 1 "2026-07-16" "1.10.1" "ClusterShell User Manual"
31 .SH NAME
32 clush \- execute shell commands on a cluster
33 .SH SYNOPSIS
34 .sp
35 \fBclush\fP \fB\-a\fP | \fB\-g\fP \fIgroup\fP | \fB\-w\fP \fInodes\fP [OPTIONS]
36 .sp
37 \fBclush\fP \fB\-a\fP | \fB\-g\fP \fIgroup\fP | \fB\-w\fP \fInodes\fP [OPTIONS] \fIcommand\fP
38 .sp
39 \fBclush\fP \fB\-a\fP | \fB\-g\fP \fIgroup\fP | \fB\-w\fP \fInodes\fP [OPTIONS] \-\-copy
40 \fIfile\fP | \fIdir\fP [ \fIfile\fP | \fIdir\fP ...] [ \-\-dest \fIpath\fP ]
41 .sp
42 \fBclush\fP \fB\-a\fP | \fB\-g\fP \fIgroup\fP | \fB\-w\fP \fInodes\fP [OPTIONS] \-\-rcopy
43 \fIfile\fP | \fIdir\fP [ \fIfile\fP | \fIdir\fP ...] [ \-\-dest \fIpath\fP ]
44 .SH DESCRIPTION
45 .sp
46 \fBclush\fP is a program for executing commands in parallel on a cluster and for
47 gathering their results. \fBclush\fP executes commands interactively or can be
48 used within shell scripts and other applications. It is a partial front\-end
49 to the ClusterShell library that ensures a light, unified and robust parallel
50 command execution framework. Thus, it allows traditional shell scripts to
51 benefit from some of the library features. \fBclush\fP currently makes use of
52 the Ssh worker of ClusterShell, by default, that only requires \fBssh\fP(1)
53 (OpenSSH SSH client).
54 .SH INVOCATION
55 .sp
56 \fBclush\fP can be started non\-interactively to run a shell \fIcommand\fP, or can
57 be invoked as an interactive shell. To start a \fBclush\fP interactive session,
58 invoke the \fBclush\fP command without providing \fIcommand\fP\&.
59 .INDENT 0.0
60 .TP
61 .B Non\-interactive mode
62 When \fBclush\fP is started non\-interactively, the \fIcommand\fP is executed on
63 the specified remote hosts in parallel. If option \fB\-b\fP or \fB\-\-dshbak\fP
64 is specified, \fBclush\fP waits for command completion and then displays
65 gathered output results.
66 .sp
67 The \fB\-w\fP option allows you to specify remote hosts by using ClusterShell
68 NodeSet syntax, including the node groups \fB@group\fP special syntax and the
69 \fBExtended Patterns\fP syntax to benefit from NodeSet basic arithmetic
70 (like \fB@Agroup\e&@Bgroup\fP). See EXTENDED PATTERNS in \fBnodeset\fP(1) and
71 also \fBgroups.conf\fP(5) for more information.
72 .sp
73 Unless the option \fB\-\-nostdin\fP (or \fB\-n\fP) is specified, \fBclush\fP detects
74 when its standard input is connected to a terminal (as determined by
75 \fBisatty\fP(3)). If actually connected to a terminal, \fBclush\fP listens to
76 standard input when commands are running, waiting for an \fIEnter\fP key press.
77 Doing so will display the status of current nodes. If standard input is not
78 connected to a terminal, and unless the option \fB\-\-nostdin\fP is specified,
79 \fBclush\fP binds the standard input of the remote commands to its own standard
80 input, allowing scripting methods like:
81 .INDENT 7.0
82 .INDENT 3.5
83 .nf
84 # echo foo | clush \-w node[40\-42] \-b cat
85 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
86 node[40\-42]
87 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
88 foo
89 .fi
90 .sp
91 .UNINDENT
92 .UNINDENT
93 .sp
94 Please see some other great examples in the EXAMPLES section below.
95 .TP
96 .B Interactive session
97 If a \fIcommand\fP is not specified, and its standard input is connected to a
98 terminal, \fBclush\fP runs interactively. In this mode, \fBclush\fP uses the GNU
99 \fBreadline\fP library to read command lines. Readline provides commands for
100 searching through the command history for lines containing a specified
101 string. For instance, type Control\-R to search in the history for the next
102 entry matching the search string typed so far. \fBclush\fP also recognizes
103 special single\-character prefixes that allow the user to see and modify
104 the current nodeset (the nodes where the commands are executed).
105 .INDENT 7.0
106 .TP
107 .B Single\-character interactive commands are:
108 .INDENT 7.0
109 .TP
110 .B clush> ?
111 show current nodeset
112 .TP
113 .B clush> @<NODESET>
114 set current nodeset
115 .TP
116 .B clush> +<NODESET>
117 add nodes to current nodeset
118 .TP
119 .B clush> \-<NODESET>
120 remove nodes from current nodeset
121 .TP
122 .B clush> !COMMAND
123 execute COMMAND on the local system
124 .TP
125 .B clush> =
126 toggle the output format (gathered or standard mode)
127 .UNINDENT
128 .UNINDENT
129 .sp
130 To leave an interactive session, type \fBquit\fP or Control\-D.
131 .TP
132 .B Local execution ( \fB\-\-worker=exec\fP or \fB\-R exec\fP )
133 Instead of running provided command on remote nodes, \fBclush\fP can use the
134 dedicated \fIexec\fP worker to launch the command \fIlocally\fP, for each node.
135 Some parameters could be used in the command line to make a different
136 command for each node. \fB%h\fP or \fB%host\fP will be replaced by node name and
137 \fB%n\fP or \fB%rank\fP by the remote rank [0\-N] (to get a literal % use %%).
138 \fB%hosts\fP will be replaced by the full target nodeset, in which case the
139 command is executed only once.
140 .TP
141 .B File copying mode ( \fB\-\-copy\fP )
142 When \fBclush\fP is started with the \fB\-c\fP or \fB\-\-copy\fP option, it will
143 attempt to copy specified \fIfiles\fP and/or \fIdirectories\fP to the provided
144 cluster nodes. The \fB\-\-dest\fP option can be used to specify a single
145 path where all the file(s) should be copied to on the target nodes.
146 In the absence of \fB\-\-dest\fP, \fBclush\fP will attempt to copy each file or
147 directory found in the command line to their same location on the
148 target nodes.
149 .TP
150 .B Reverse file copying mode ( \fB\-\-rcopy\fP )
151 When \fBclush\fP is started with the \fB\-\-rcopy\fP option, it will attempt to
152 retrieve specified \fIfile\fP and/or \fIdir\fP from provided cluster nodes. If the
153 \fB\-\-dest\fP option is specified, it must be a directory path where the files
154 will be stored with their hostname appended. If the destination path is not
155 specified, it will take each \fIfile\fP or \fIdirectory\fP\(aqs parent directory as the
156 local destination.
157 .UNINDENT
158 .SH OPTIONS
159 .INDENT 0.0
160 .TP
161 .B \-\-version
162 show \fBclush\fP version number and exit
163 .TP
164 .BI \-s \ GROUPSOURCE\fR,\fB \ \-\-groupsource\fB= GROUPSOURCE
165 optional \fBgroups.conf\fP(5) group source to use
166 .TP
167 .B \-n\fP,\fB \-\-nostdin
168 do not watch for possible input from stdin; this should be used when \fBclush\fP is run in the background (or in scripts).
169 .TP
170 .BI \-\-groupsconf\fB= FILE
171 use alternate config file for \fBgroups.conf\fP(5)
172 .TP
173 .BI \-\-conf\fB= FILE
174 use alternate config file for \fBclush.conf\fP(5)
175 .TP
176 .BI \-O \ <KEY=VALUE>\fR,\fB \ \-\-option\fB= <KEY=VALUE>
177 override any key=value \fBclush.conf\fP(5) options (repeat as needed)
178 .UNINDENT
179 .INDENT 0.0
180 .TP
181 .B Selecting target nodes:
182 .INDENT 7.0
183 .TP
184 .BI \-w \ NODES
185 nodes where to run the command
186 .TP
187 .BI \-x \ NODES
188 exclude nodes from the node list
189 .TP
190 .B \-a\fP,\fB \-\-all
191 run command on all nodes
192 .TP
193 .BI \-g \ GROUP\fR,\fB \ \-\-group\fB= GROUP
194 run command on a group of nodes
195 .TP
196 .BI \-X \ GROUP
197 exclude nodes from this group
198 .TP
199 .BI \-\-hostfile\fB= FILE\fR,\fB \ \-\-machinefile\fB= FILE
200 path to a file containing a list of single hosts, node sets or node groups, separated by spaces and lines (may be specified multiple times, one per file)
201 .TP
202 .BI \-\-topology\fB= FILE
203 topology configuration file to use for tree mode
204 .TP
205 .BI \-\-pick\fB= N
206 pick N node(s) at random in nodeset
207 .UNINDENT
208 .TP
209 .B Output behavior:
210 .INDENT 7.0
211 .TP
212 .B \-q\fP,\fB \-\-quiet
213 be quiet, print essential output only
214 .TP
215 .B \-v\fP,\fB \-\-verbose
216 be verbose, print informative messages
217 .TP
218 .B \-d\fP,\fB \-\-debug
219 output more messages for debugging purpose
220 .TP
221 .B \-G\fP,\fB \-\-groupbase
222 do not display group source prefix (always \fB@groupname\fP)
223 .TP
224 .B \-L
225 disable header block and order output by nodes; if \-b/\-B is not specified, \fBclush\fP will wait for all commands to finish and then display aggregated output of commands with same return codes, ordered by node name; alternatively, when used in conjunction with \-b/\-B (e.g. \-bL), \fBclush\fP will enable a \(dqlive gathering\(dq of results by line, so that the next line is displayed as soon as possible (e.g. when all nodes have sent the line)
226 .TP
227 .B \-N
228 disable labeling of command output
229 .TP
230 .B \-P\fP,\fB \-\-progress
231 show progress during command execution; if writing is performed to standard input, the live progress indicator will display the global bandwidth of data written to the target nodes
232 .TP
233 .B \-b\fP,\fB \-\-dshbak
234 display gathered results in a dshbak\-like way (note: it will only try to aggregate the output of commands with same return codes)
235 .TP
236 .B \-B
237 like \-b but including standard error
238 .TP
239 .B \-r\fP,\fB \-\-regroup
240 fold nodeset using node groups
241 .TP
242 .BI \-\-axis\fB= RANGESET
243 for nD nodesets, fold the displayed nodeset (e.g. in gathered output headers) along provided axis only. Axes are indexed from 1 to n and can be specified here either using the rangeset syntax, e.g. \(aq1\(aq, \(aq1\-2\(aq, \(aq1,3\(aq, or by a single negative number meaning that the index is counted from the end. Because some nodesets may have several different dimensions, axis indices are silently truncated to fall in the allowed range. This is the per\-invocation equivalent of the \fBfold_axis\fP library default.
244 .TP
245 .B \-S\fP,\fB \-\-maxrc
246 return the largest of command return codes
247 .TP
248 .BI \-\-color\fB= WHENCOLOR
249 \fBclush\fP can use NO_COLOR, CLICOLOR and CLICOLOR_FORCE environment variables. NO_COLOR takes precedence over CLICOLOR_FORCE which takes precedence over CLICOLOR. When \fB\-\-color\fP option is used these environment variables are not taken into account. \fB\-\-color\fP tells whether to use ANSI colors to surround node or nodeset prefix/header with escape sequences to display them in color on the terminal. \fIWHENCOLOR\fP is \fBnever\fP, \fBalways\fP or \fBauto\fP (which uses color if standard output/error refer to a terminal). Colors are set to [34m (blue foreground text) for stdout and [31m (red foreground text) for stderr, and cannot be modified.
250 .TP
251 .B \-\-diff
252 show diff between common outputs (find the best reference output by focusing on largest nodeset and also smaller command return code)
253 .TP
254 .BI \-\-outdir\fB= OUTDIR
255 output directory for stdout files (OPTIONAL)
256 .TP
257 .BI \-\-errdir\fB= ERRDIR
258 output directory for stderr files (OPTIONAL)
259 .UNINDENT
260 .TP
261 .B File copying:
262 .INDENT 7.0
263 .TP
264 .B \-c\fP,\fB \-\-copy
265 copy local file or directory to remote nodes
266 .TP
267 .B \-\-rcopy
268 copy file or directory from remote nodes
269 .TP
270 .BI \-\-dest\fB= DEST_PATH
271 destination file or directory on the nodes
272 (optional: use the first source directory
273 path when not specified)
274 .TP
275 .B \-p
276 preserve modification times and modes
277 .UNINDENT
278 .TP
279 .B Connection options:
280 .INDENT 7.0
281 .TP
282 .BI \-f \ FANOUT\fR,\fB \ \-\-fanout\fB= FANOUT
283 do not execute more than FANOUT commands at the same time, useful to limit resource usage. In tree mode, the same \fIfanout\fP value is used on the head node and on each gateway (the \fIfanout\fP value is propagated). That is, if the \fIfanout\fP is \fB16\fP, each gateway will initiate up to \fB16\fP connections to their target nodes at the same time. Default \fIfanout\fP value is defined in \fBclush.conf\fP(5).
284 .TP
285 .BI \-l \ USER\fR,\fB \ \-\-user\fB= USER
286 execute remote command as user
287 .TP
288 .BI \-o \ OPTIONS\fR,\fB \ \-\-options\fB= OPTIONS
289 can be used to give ssh options, e.g. \fB\-o \(dq\-p 2022 \-i ~/.ssh/myidrsa\(dq\fP; these options are added first to ssh and override default ones
290 .TP
291 .BI \-t \ CONNECT_TIMEOUT\fR,\fB \ \-\-connect_timeout\fB= CONNECT_TIMEOUT
292 limit time to connect to a node
293 .TP
294 .BI \-u \ COMMAND_TIMEOUT\fR,\fB \ \-\-command_timeout\fB= COMMAND_TIMEOUT
295 limit time for command to run on the node
296 .TP
297 .BI \-m \ MODE\fR,\fB \ \-\-mode\fB= MODE
298 run mode; define MODEs in \fB<confdir>/*.conf\fP
299 .TP
300 .BI \-R \ WORKER\fR,\fB \ \-\-worker\fB= WORKER
301 worker name to use for connection (\fBexec\fP, \fBssh\fP, \fBrsh\fP, \fBpdsh\fP, or the name of a Python worker module), default is \fBssh\fP
302 .TP
303 .BI \-\-remote\fB= REMOTE
304 whether to enable remote execution: in tree mode, \(aqyes\(aq forces connections to the leaf nodes for execution, \(aqno\(aq establishes connections up to the leaf parent nodes for execution (default is \(aqyes\(aq)
305 .UNINDENT
306 .UNINDENT
307 .sp
308 For a short explanation of these options, see \fB\-h, \-\-help\fP\&.
309 .SH EXIT STATUS
310 .sp
311 By default, an exit status of zero indicates success of the \fBclush\fP command
312 but gives no information about the remote commands exit status. However, when
313 the \fB\-S\fP option is specified, the exit status of \fBclush\fP is the largest
314 value of the remote commands return codes.
315 .sp
316 For failed remote commands whose exit status is non\-zero, and unless the
317 combination of options \fB\-qS\fP is specified, \fBclush\fP displays messages
318 similar to:
319 .INDENT 0.0
320 .TP
321 .B clush: node[40\-42]: exited with exit code 1
322 .UNINDENT
323 .SH EXAMPLES
324 .SS Remote parallel execution
325 .INDENT 0.0
326 .TP
327 .B # clush \-w node[3\-5,62] uname \-r
328 Run command \fIuname \-r\fP in parallel on nodes: node3, node4, node5 and node62
329 .UNINDENT
330 .SS Local parallel execution
331 .INDENT 0.0
332 .TP
333 .B # clush \-w node[1\-3] \-\-worker=exec ping \-c1 %host
334 Run locally, in parallel, a ping command for nodes: node1, node2 and node3.
335 You may also use \fB\-R exec\fP as the shorter and pdsh compatible option.
336 .UNINDENT
337 .SS Display features
338 .INDENT 0.0
339 .TP
340 .B # clush \-w node[3\-5,62] \-b uname \-r
341 Run command \fIuname \-r\fP on nodes[3\-5,62] and display gathered output results (integrated \fBdshbak\fP\-like).
342 .TP
343 .B # clush \-w node[3\-5,62] \-bL uname \-r
344 Line mode: run command \fIuname \-r\fP on nodes[3\-5,62] and display gathered output results without default header block.
345 .TP
346 .B # ssh node32 find /etc/yum.repos.d \-type f | clush \-w node[40\-42] \-b xargs ls \-l
347 Search some files on node32 in /etc/yum.repos.d and use clush to list the matching ones on node[40\-42], and use \fB\-b\fP to display gathered results.
348 .TP
349 .B # clush \-w node[3\-5,62] \-\-diff dmidecode \-s bios\-version
350 Run this Linux command to get BIOS version on nodes[3\-5,62] and show version differences (if any).
351 .TP
352 .B # clush \-w dc[1\-2]n[1\-2] \-\-axis=1 \-b uname \-r
353 Gather output and fold the displayed nodeset header along axis 1 only, e.g. show \fBdc[1\-2]n1,dc[1\-2]n2\fP rather than \fBdc[1\-2]n[1\-2]\fP in the header block. See also \fBfold_axis\fP in the Library Defaults configuration to change it permanently.
354 .UNINDENT
355 .SS All nodes
356 .INDENT 0.0
357 .TP
358 .B # clush \-a uname \-r
359 Run command \fIuname \-r\fP on all cluster nodes, see \fBgroups.conf\fP(5) to set up all cluster nodes (\fIall:\fP field).
360 .TP
361 .B # clush \-a \-x node[5,7] uname \-r
362 Run command \fIuname \-r\fP on all cluster nodes except on nodes node5 and node7.
363 .TP
364 .B # clush \-a \-\-diff cat /some/file
365 Run command \fIcat /some/file\fP on all cluster nodes and show differences (if any), line by line, between common outputs.
366 .UNINDENT
367 .SS Node groups
368 .INDENT 0.0
369 .TP
370 .B # clush \-w @oss modprobe lustre
371 Run command \fImodprobe lustre\fP on nodes from node group named \fIoss\fP, see \fBgroups.conf\fP(5) to setup node groups (\fImap:\fP field).
372 .TP
373 .B # clush \-g oss modprobe lustre
374 Same as previous example but using \fB\-g\fP to avoid \fI@\fP group prefix.
375 .TP
376 .B # clush \-w @mds,@oss modprobe lustre
377 You may specify several node groups by separating them with commas (please see EXTENDED PATTERNS in \fBnodeset\fP(1) and also \fBgroups.conf\fP(5) for more information).
378 .UNINDENT
379 .SS Copy files
380 .INDENT 0.0
381 .TP
382 .B # clush \-w node[3\-5,62] \-\-copy /etc/motd
383 Copy local file \fI/etc/motd\fP to remote nodes node[3\-5,62].
384 .TP
385 .B # clush \-w node[3\-5,62] \-\-copy /etc/motd \-\-dest /tmp/motd2
386 Copy local file \fI/etc/motd\fP to remote nodes node[3\-5,62] at path \fI/tmp/motd2\fP\&.
387 .TP
388 .B # clush \-w node[3\-5,62] \-c /usr/share/doc/clustershell
389 Recursively copy local directory \fI/usr/share/doc/clustershell\fP to the same
390 path on remote nodes node[3\-5,62].
391 .TP
392 .B # clush \-w node[3\-5,62] \-\-rcopy /etc/motd \-\-dest /tmp
393 Copy \fI/etc/motd\fP from remote nodes node[3\-5,62] to local \fI/tmp\fP directory, each file having their remote hostname appended, e.g. \fI/tmp/motd.node3\fP\&.
394 .UNINDENT
395 .SH FILES
396 .INDENT 0.0
397 .TP
398 .B \fI$CLUSTERSHELL_CFGDIR/clush.conf\fP
399 Global clush configuration file. If $CLUSTERSHELL_CFGDIR is not defined,
400 \fI/etc/clustershell/clush.conf\fP is used instead.
401 .TP
402 .B \fI$XDG_CONFIG_HOME/clustershell/clush.conf\fP
403 User configuration file for clush. If $XDG_CONFIG_HOME is not defined,
404 \fI$HOME/.config/clustershell/clush.conf\fP is used instead.
405 .TP
406 .B \fI{sys.prefix}/etc/clustershell/clush.conf\fP
407 Configuration file when ClusterShell is installed in a Python virtual
408 environment.
409 .TP
410 .B \fI$HOME/.local/etc/clustershell/clush.conf\fP
411 Local user configuration file for clush (default installation for pip \-\-user)
412 .TP
413 .B \fI~/.clush.conf\fP
414 Deprecated per\-user clush configuration file (no longer read since
415 version 1.9).
416 .TP
417 .B \fI~/.clush_history\fP
418 File in which interactive \fBclush\fP command history is saved.
419 .UNINDENT
420 .SH SEE ALSO
421 .sp
422 \fBclubak\fP(1), \fBcluset\fP(1), \fBnodeset\fP(1), \fBreadline\fP(3), \fBclush.conf\fP(5), \fBgroups.conf\fP(5).
423 .sp
424 \fI\%https://clustershell.readthedocs.io/\fP
425 .SH BUG REPORTS
426 .INDENT 0.0
427 .TP
428 .B Use the following URL to submit a bug report or feedback:
429 \fI\%https://github.com/clustershell/clustershell/issues\fP
430 .UNINDENT
431 .SH AUTHOR
432 Stephane Thiell
433 .SH COPYRIGHT
434 GNU Lesser General Public License version 2.1 or later (LGPLv2.1+)
435 .\" Generated by docutils manpage writer.
436 .