When in verbose mode with -p, each line is prefixed with the node
[sahlberg/ctdb.git] / doc / onnode.1
1 .\"     Title: onnode
2 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
3 .\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
4 .\"      Date: 07/10/2008
5 .\"    Manual: [FIXME: manual]
6 .\"    Source: [FIXME: source]
7 .\"  Language: English
8 .\"
9 .TH "ONNODE" "1" "07/10/2008" "[FIXME: source]" "[FIXME: manual]"
10 .\" -----------------------------------------------------------------
11 .\" * (re)Define some macros
12 .\" -----------------------------------------------------------------
13 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14 .\" toupper - uppercase a string (locale-aware)
15 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 .de toupper
17 .tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
18 \\$*
19 .tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
20 ..
21 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 .\" SH-xref - format a cross-reference to an SH section
23 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 .de SH-xref
25 .ie n \{\
26 .\}
27 .toupper \\$*
28 .el \{\
29 \\$*
30 .\}
31 ..
32 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33 .\" SH - level-one heading that works better for non-TTY output
34 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35 .de1 SH
36 .\" put an extra blank line of space above the head in non-TTY output
37 .if t \{\
38 .sp 1
39 .\}
40 .sp \\n[PD]u
41 .nr an-level 1
42 .set-an-margin
43 .nr an-prevailing-indent \\n[IN]
44 .fi
45 .in \\n[an-margin]u
46 .ti 0
47 .HTML-TAG ".NH \\n[an-level]"
48 .it 1 an-trap
49 .nr an-no-space-flag 1
50 .nr an-break-flag 1
51 \." make the size of the head bigger
52 .ps +3
53 .ft B
54 .ne (2v + 1u)
55 .ie n \{\
56 .\" if n (TTY output), use uppercase
57 .toupper \\$*
58 .\}
59 .el \{\
60 .nr an-break-flag 0
61 .\" if not n (not TTY), use normal case (not uppercase)
62 \\$1
63 .in \\n[an-margin]u
64 .ti 0
65 .\" if not n (not TTY), put a border/line under subheading
66 .sp -.6
67 \l'\n(.lu'
68 .\}
69 ..
70 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71 .\" SS - level-two heading that works better for non-TTY output
72 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 .de1 SS
74 .sp \\n[PD]u
75 .nr an-level 1
76 .set-an-margin
77 .nr an-prevailing-indent \\n[IN]
78 .fi
79 .in \\n[IN]u
80 .ti \\n[SN]u
81 .it 1 an-trap
82 .nr an-no-space-flag 1
83 .nr an-break-flag 1
84 .ps \\n[PS-SS]u
85 \." make the size of the head bigger
86 .ps +2
87 .ft B
88 .ne (2v + 1u)
89 .if \\n[.$] \&\\$*
90 ..
91 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92 .\" BB/BE - put background/screen (filled box) around block of text
93 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94 .de BB
95 .if t \{\
96 .sp -.5
97 .br
98 .in +2n
99 .ll -2n
100 .gcolor red
101 .di BX
102 .\}
103 ..
104 .de EB
105 .if t \{\
106 .if "\\$2"adjust-for-leading-newline" \{\
107 .sp -1
108 .\}
109 .br
110 .di
111 .in
112 .ll
113 .gcolor
114 .nr BW \\n(.lu-\\n(.i
115 .nr BH \\n(dn+.5v
116 .ne \\n(BHu+.5v
117 .ie "\\$2"adjust-for-leading-newline" \{\
118 \M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
119 .\}
120 .el \{\
121 \M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
122 .\}
123 .in 0
124 .sp -.5v
125 .nf
126 .BX
127 .in
128 .sp .5v
129 .fi
130 .\}
131 ..
132 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133 .\" BM/EM - put colored marker in margin next to block of text
134 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135 .de BM
136 .if t \{\
137 .br
138 .ll -2n
139 .gcolor red
140 .di BX
141 .\}
142 ..
143 .de EM
144 .if t \{\
145 .br
146 .di
147 .ll
148 .gcolor
149 .nr BH \\n(dn
150 .ne \\n(BHu
151 \M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
152 .in 0
153 .nf
154 .BX
155 .in
156 .fi
157 .\}
158 ..
159 .\" -----------------------------------------------------------------
160 .\" * set default formatting
161 .\" -----------------------------------------------------------------
162 .\" disable hyphenation
163 .nh
164 .\" disable justification (adjust text to left margin only)
165 .ad l
166 .\" -----------------------------------------------------------------
167 .\" * MAIN CONTENT STARTS HERE *
168 .\" -----------------------------------------------------------------
169 .SH "Name"
170 onnode \- run commands on ctdb nodes
171 .SH "Synopsis"
172 .fam C
173 .HP \w'\fBonnode\ [OPTION]\ \&.\&.\&.\ NODES\ COMMAND\ \&.\&.\&.\fR\ 'u
174 \fBonnode [OPTION] \&.\&.\&. NODES COMMAND \&.\&.\&.\fR
175 .fam
176 .SH "DESCRIPTION"
177 .PP
178 onnode is a utility to run commands on a specific node of a CTDB cluster, or on all nodes\&.
179 .PP
180 The NODES option specifies which node to run a command on\&. You can specify a numeric node number (from 0 to N\-1) or the special node \'all\'\&. You can also specify lists of nodes, separated by commas, and ranges of numeric node numbers, separated by dashes\&. If nodes are specified multiple times then the command will be executed multiple times on those nodes\&. The order of nodes is significant\&.
181 .PP
182 The COMMAND can be any shell command\&. The onnode utility uses ssh or rsh to connect to the remote nodes and run the command\&.
183 .SH "OPTIONS"
184 .PP
185 \-c
186 .RS 4
187 Execute COMMAND in the current working directory on each node\&.
188 .RE
189 .PP
190 \-p
191 .RS 4
192 Run commands in parallel on the specified nodes\&. In this mode
193 .RE
194 .PP
195 \-q
196 .RS 4
197 Do not print node addresses\&. Normally, onnode prints informational node addresses if more than one node is specified\&. This overrides \-v\&.
198 .RE
199 .PP
200 \-v
201 .RS 4
202 Print a node addresses even if only one node is specified\&. Normally, onnode prints informational node addresses when more than one node is specified\&.
203 .RE
204 .PP
205 \-h, \-\-help
206 .RS 4
207 Show a short usage guide\&.
208 .RE
209 .SH "EXAMPLES"
210 .PP
211 The following command would show the process ID of ctdb on all nodes
212 .sp
213 .if n \{\
214 .RS 4
215 .\}
216 .fam C
217 .ps -1
218 .nf
219 .if t \{\
220 .sp -1
221 .\}
222 .BB lightgray adjust-for-leading-newline
223 .sp -1
224
225       onnode all pidof ctdbd
226     
227 .EB lightgray adjust-for-leading-newline
228 .if t \{\
229 .sp 1
230 .\}
231 .fi
232 .fam
233 .ps +1
234 .if n \{\
235 .RE
236 .\}
237 .PP
238 The following command would show the last 5 lines of log on each node, preceded by the node\'s hostname
239 .sp
240 .if n \{\
241 .RS 4
242 .\}
243 .fam C
244 .ps -1
245 .nf
246 .if t \{\
247 .sp -1
248 .\}
249 .BB lightgray adjust-for-leading-newline
250 .sp -1
251
252       onnode all "hostname; tail \-5 /var/log/log\&.ctdb"
253     
254 .EB lightgray adjust-for-leading-newline
255 .if t \{\
256 .sp 1
257 .\}
258 .fi
259 .fam
260 .ps +1
261 .if n \{\
262 .RE
263 .\}
264 .PP
265 The following command would restart the ctdb service on all nodes\&.
266 .sp
267 .if n \{\
268 .RS 4
269 .\}
270 .fam C
271 .ps -1
272 .nf
273 .if t \{\
274 .sp -1
275 .\}
276 .BB lightgray adjust-for-leading-newline
277 .sp -1
278
279       onnode all service ctdb restart
280     
281 .EB lightgray adjust-for-leading-newline
282 .if t \{\
283 .sp 1
284 .\}
285 .fi
286 .fam
287 .ps +1
288 .if n \{\
289 .RE
290 .\}
291 .PP
292 The following command would run \&./foo in the current working directory, in parallel, on nodes 0, 2, 3 and 4\&.
293 .sp
294 .if n \{\
295 .RS 4
296 .\}
297 .fam C
298 .ps -1
299 .nf
300 .if t \{\
301 .sp -1
302 .\}
303 .BB lightgray adjust-for-leading-newline
304 .sp -1
305
306       onnode \-c \-p 0,2\-4 \&./foo
307     
308 .EB lightgray adjust-for-leading-newline
309 .if t \{\
310 .sp 1
311 .\}
312 .fi
313 .fam
314 .ps +1
315 .if n \{\
316 .RE
317 .\}
318 .SH "FILES"
319 .PP
320 /etc/ctdb/nodes
321 .RS 4
322 Contains a list of each node\'s IP address or hostname\&.
323 .RE
324 .PP
325 /etc/ctdb/onnode\&.conf
326 .RS 4
327 If this file exists it is sourced by onnode\&. The main purpose is to allow the administrator to set $SSH to something other than "ssh"\&. In this case the \-t option is ignored\&. For example, the administrator may choose to use use rsh instead of ssh\&.
328 .RE
329 .SH "SEE ALSO"
330 .PP
331 ctdbd(1), ctdb(1),
332 \m[blue]\fB\%http://ctdb.samba.org/\fR\m[]
333 .SH "COPYRIGHT/LICENSE"
334 .sp
335 .if n \{\
336 .RS 4
337 .\}
338 .fam C
339 .ps -1
340 .nf
341 .if t \{\
342 .sp -1
343 .\}
344 .BB lightgray adjust-for-leading-newline
345 .sp -1
346
347 Copyright (C) Andrew Tridgell 2007
348 Copyright (C) Ronnie sahlberg 2007
349 Copyright (C) Martin Schwenke 2008
350
351 This program is free software; you can redistribute it and/or modify
352 it under the terms of the GNU General Public License as published by
353 the Free Software Foundation; either version 3 of the License, or (at
354 your option) any later version\&.
355
356 This program is distributed in the hope that it will be useful, but
357 WITHOUT ANY WARRANTY; without even the implied warranty of
358 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\&.  See the GNU
359 General Public License for more details\&.
360
361 You should have received a copy of the GNU General Public License
362 along with this program; if not, see http://www\&.gnu\&.org/licenses/\&.
363 .EB lightgray adjust-for-leading-newline
364 .if t \{\
365 .sp 1
366 .\}
367 .fi
368 .fam
369 .ps +1
370 .if n \{\
371 .RE
372 .\}