When in verbose mode with -p, each line is prefixed with the node
[sahlberg/ctdb.git] / doc / onnode.1.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <refentry id="onnode.1">
4
5 <refmeta>
6         <refentrytitle>onnode</refentrytitle>
7         <manvolnum>1</manvolnum>
8 </refmeta>
9
10
11 <refnamediv>
12         <refname>onnode</refname>
13         <refpurpose>run commands on ctdb nodes</refpurpose>
14 </refnamediv>
15
16 <refsynopsisdiv>
17         <cmdsynopsis>
18                 <command>onnode [OPTION] ... NODES COMMAND ...</command>
19         </cmdsynopsis>
20 </refsynopsisdiv>
21
22   <refsect1><title>DESCRIPTION</title>
23     <para>
24       onnode is a utility to run commands on a specific node of a CTDB
25       cluster, or on all nodes.
26     </para>
27     <para>
28       The NODES option specifies which node to run a command on. You
29       can specify a numeric node number (from 0 to N-1) or the special
30       node 'all'.  You can also specify lists of nodes, separated by
31       commas, and ranges of numeric node numbers, separated by dashes.
32       If nodes are specified multiple times then the command will be
33       executed multiple times on those nodes.  The order of nodes is
34       significant.
35     </para>
36     <para>
37       The COMMAND can be any shell command. The onnode utility uses
38       ssh or rsh to connect to the remote nodes and run the command.
39       </para>
40   </refsect1>
41
42   <refsect1><title>OPTIONS</title>
43
44     <variablelist>
45       <varlistentry><term>-c</term>
46         <listitem>
47           <para>
48             Execute COMMAND in the current working directory on each
49             node.
50           </para>
51         </listitem>
52       </varlistentry>
53
54       <varlistentry><term>-p</term>
55         <listitem>
56           <para>
57             Run commands in parallel on the specified nodes.  In this
58             mode 
59           </para>
60         </listitem>
61       </varlistentry>
62
63       <varlistentry><term>-q</term>
64         <listitem>
65           <para>
66             Do not print node addresses.  Normally, onnode prints
67             informational node addresses if more than one node is
68             specified.  This overrides -v.
69           </para>
70         </listitem>
71       </varlistentry>
72
73       <varlistentry><term>-v</term>
74         <listitem>
75           <para>
76             Print a node addresses even if only one node is specified.
77             Normally, onnode prints informational node addresses when
78             more than one node is specified.
79           </para>
80         </listitem>
81       </varlistentry>
82
83       <varlistentry><term>-h, --help</term>
84         <listitem>
85           <para>
86             Show a short usage guide.
87           </para>
88         </listitem>
89       </varlistentry>
90     </variablelist>
91   </refsect1>
92
93   <refsect1><title>EXAMPLES</title>
94     <para>
95       The following command would show the process ID of ctdb on all nodes
96     </para>
97     <screen format="linespecific">
98       onnode all pidof ctdbd
99     </screen>
100
101     <para>
102       The following command would show the last 5 lines of log on each
103       node, preceded by the node's hostname
104     </para>
105     <screen format="linespecific">
106       onnode all "hostname; tail -5 /var/log/log.ctdb"
107     </screen>
108
109     <para>
110       The following command would restart the ctdb service on all nodes.
111     </para>
112     <screen format="linespecific">
113       onnode all service ctdb restart
114     </screen>
115
116     <para>
117       The following command would run ./foo in the current working
118       directory, in parallel, on nodes 0, 2, 3 and 4.
119     </para>
120     <screen format="linespecific">
121       onnode -c -p 0,2-4 ./foo
122     </screen>
123   </refsect1>
124
125   <refsect1><title>FILES</title>
126
127     <variablelist>
128       <varlistentry><term>/etc/ctdb/nodes</term>
129         <listitem>
130           <para>
131             Contains a list of each node's IP address or hostname.
132           </para>
133         </listitem>
134       </varlistentry>
135
136       <varlistentry><term>/etc/ctdb/onnode.conf</term>
137         <listitem>
138           <para>
139             If this file exists it is sourced by onnode.  The main
140             purpose is to allow the administrator to set $SSH to
141             something other than "ssh".  In this case the -t option is
142             ignored.  For example, the administrator may choose to use
143             use rsh instead of ssh.
144           </para>
145         </listitem>
146       </varlistentry>
147     </variablelist>
148   </refsect1>
149
150   <refsect1><title>SEE ALSO</title>
151     <para>
152       ctdbd(1), ctdb(1), <ulink url="http://ctdb.samba.org/"/>
153     </para>
154   </refsect1>
155   <refsect1><title>COPYRIGHT/LICENSE</title>
156 <literallayout>
157 Copyright (C) Andrew Tridgell 2007
158 Copyright (C) Ronnie sahlberg 2007
159 Copyright (C) Martin Schwenke 2008
160
161 This program is free software; you can redistribute it and/or modify
162 it under the terms of the GNU General Public License as published by
163 the Free Software Foundation; either version 3 of the License, or (at
164 your option) any later version.
165
166 This program is distributed in the hope that it will be useful, but
167 WITHOUT ANY WARRANTY; without even the implied warranty of
168 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
169 General Public License for more details.
170
171 You should have received a copy of the GNU General Public License
172 along with this program; if not, see http://www.gnu.org/licenses/.
173 </literallayout>
174   </refsect1>
175 </refentry>