3 <title>ntpdc: NTPD Control User's Manual</title>
4 <meta http-equiv="Content-Type" content="text/html">
5 <meta name="description" content="ntpdc: NTPD Control User's Manual">
6 <meta name="generator" content="makeinfo 4.7">
7 <link title="Top" rel="top" href="#Top">
8 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
9 <meta http-equiv="Content-Style-Type" content="text/css">
10 <style type="text/css"><!--
11 pre.display { font-family:inherit }
12 pre.format { font-family:inherit }
13 pre.smalldisplay { font-family:inherit; font-size:smaller }
14 pre.smallformat { font-family:inherit; font-size:smaller }
15 pre.smallexample { font-size:smaller }
16 pre.smalllisp { font-size:smaller }
17 span.sc { font-variant:small-caps }
18 span.roman { font-family: serif; font-weight: normal; }
22 <h1 class="settitle">ntpdc: NTPD Control User's Manual</h1>
25 <a name="Top"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-Description">ntpdc Description</a>,
26 Previous: <a rel="previous" accesskey="p" href="#dir">(dir)</a>,
27 Up: <a rel="up" accesskey="u" href="#dir">(dir)</a>
31 <h2 class="unnumbered">ntpdc: NTPD Control User Manual</h2>
33 <p>This document describes the use of the NTP Project's <code>ntpdc</code> program,
34 that can be used to query a Network Time Protocol (NTP) server and
35 display the time offset of the system clock relative to the server
36 clock. Run as root, it can correct the system clock to this offset as
37 well. It can be run as an interactive command or from a cron job.
39 <p>This document applies to version 4.2.8p11 of <code>ntpdc</code>.
41 <p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
44 <div class="shortcontents">
45 <h2>Short Contents</h2>
47 <a href="#Top">ntpdc: NTPD Control User Manual</a>
52 <li><a accesskey="1" href="#ntpdc-Description">ntpdc Description</a>: Description
53 <li><a accesskey="2" href="#ntpdc-Invocation">ntpdc Invocation</a>: Invoking ntpdc
54 <li><a accesskey="3" href="#Usage">Usage</a>: Usage
59 <a name="ntpdc-Description"></a>
63 <!-- node-name, next, previous, up -->
64 <h3 class="section">Description</h3>
66 <p>By default, <code>ntpdc</code> writes the local data and time (i.e., not UTC) to the
67 standard output in the format:
69 <pre class="example"> 1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs
72 YYYY-MM-DD HH:MM:SS.SUBSEC is the local date and time,
73 (+0800) is the local timezone adjustment (so we would add 8 hours and 0 minutes to convert the reported local time to UTC),
75 the +4.567 +/- 0.089 secs indicates the time offset and
76 error bound of the system clock relative to the server clock.
80 <a name="ntpdc-Invocation"></a>
84 <h3 class="section">Invoking ntpdc</h3>
86 <p><a name="index-ntpdc-1"></a><a name="index-vendor_002dspecific-NTPD-control-program-2"></a>
91 <code>ntpq(1ntpqmdoc)</code> instead - it can do everything
93 used to do, and it does so using a much more sane interface.
96 is a utility program used to query
97 <code>ntpd(1ntpdmdoc)</code>
99 current state and to request changes in that state.
100 It uses NTP mode 7 control message formats described in the source code.
102 be run either in interactive mode or controlled using command line
104 Extensive state and statistics information is available
108 In addition, nearly all the
109 configuration options which can be specified at startup using
110 ntpd's configuration file may also be specified at run time using
113 <p>This section was generated by <strong>AutoGen</strong>,
114 using the <code>agtexi-cmd</code> template and the option descriptions for the <code>ntpdc</code> program.
115 This software is released under the NTP license, <http://ntp.org/license>.
118 <li><a accesskey="1" href="#ntpdc-usage">ntpdc usage</a>: ntpdc help/usage (<span class="option">--help</span>)
119 <li><a accesskey="2" href="#ntpdc-ipv4">ntpdc ipv4</a>: ipv4 option (-4)
120 <li><a accesskey="3" href="#ntpdc-ipv6">ntpdc ipv6</a>: ipv6 option (-6)
121 <li><a accesskey="4" href="#ntpdc-command">ntpdc command</a>: command option (-c)
122 <li><a accesskey="5" href="#ntpdc-interactive">ntpdc interactive</a>: interactive option (-i)
123 <li><a accesskey="6" href="#ntpdc-listpeers">ntpdc listpeers</a>: listpeers option (-l)
124 <li><a accesskey="7" href="#ntpdc-numeric">ntpdc numeric</a>: numeric option (-n)
125 <li><a accesskey="8" href="#ntpdc-peers">ntpdc peers</a>: peers option (-p)
126 <li><a accesskey="9" href="#ntpdc-showpeers">ntpdc showpeers</a>: showpeers option (-s)
127 <li><a href="#ntpdc-config">ntpdc config</a>: presetting/configuring ntpdc
128 <li><a href="#ntpdc-exit-status">ntpdc exit status</a>: exit status
129 <li><a href="#ntpdc-Usage">ntpdc Usage</a>: Usage
130 <li><a href="#ntpdc-See-Also">ntpdc See Also</a>: See Also
131 <li><a href="#ntpdc-Authors">ntpdc Authors</a>: Authors
132 <li><a href="#ntpdc-Bugs">ntpdc Bugs</a>: Bugs
137 <a name="ntpdc-usage"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-ipv4">ntpdc ipv4</a>,
138 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
142 <h4 class="subsection">ntpdc help/usage (<span class="option">--help</span>)</h4>
144 <p><a name="index-ntpdc-help-3"></a>
145 This is the automatically generated usage text for ntpdc.
147 <p>The text printed is the same whether selected with the <code>help</code> option
148 (<span class="option">--help</span>) or the <code>more-help</code> option (<span class="option">--more-help</span>). <code>more-help</code> will print
149 the usage text by passing it through a pager program.
150 <code>more-help</code> is disabled on platforms without a working
151 <code>fork(2)</code> function. The <code>PAGER</code> environment variable is
152 used to select the program, defaulting to <span class="file">more</span>. Both will exit
153 with a status code of 0.
155 <pre class="example">ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p11
156 Usage: ntpdc [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]
157 Flg Arg Option-Name Description
158 -4 no ipv4 Force IPv4 DNS name resolution
159 - prohibits the option 'ipv6'
160 -6 no ipv6 Force IPv6 DNS name resolution
161 - prohibits the option 'ipv4'
162 -c Str command run a command and exit
163 - may appear multiple times
164 -d no debug-level Increase debug verbosity level
165 - may appear multiple times
166 -D Num set-debug-level Set the debug verbosity level
167 - may appear multiple times
168 -i no interactive Force ntpq to operate in interactive mode
169 - prohibits these options:
174 -l no listpeers Print a list of the peers
175 - prohibits the option 'command'
176 -n no numeric numeric host addresses
177 -p no peers Print a list of the peers
178 - prohibits the option 'command'
179 -s no showpeers Show a list of the peers
180 - prohibits the option 'command'
181 opt version output version information and exit
182 -? no help display extended usage information and exit
183 -! no more-help extended usage information passed thru pager
184 -> opt save-opts save the option state to a config file
185 -< Str load-opts load options from a config file
186 - disabled as '--no-load-opts'
187 - may appear multiple times
189 Options are specified by doubled hyphens and their name or by a single
190 hyphen and the flag character.
193 The following option preset mechanisms are supported:
194 - reading file $HOME/.ntprc
195 - reading file ./.ntprc
196 - examining environment variables named NTPDC_*
198 Please send bug reports to: <http://bugs.ntp.org, bugs@ntp.org>
202 <a name="ntpdc-ipv4"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-ipv6">ntpdc ipv6</a>,
203 Previous: <a rel="previous" accesskey="p" href="#ntpdc-usage">ntpdc usage</a>,
204 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
208 <h4 class="subsection">ipv4 option (-4)</h4>
210 <p><a name="index-ntpdc_002dipv4-4"></a>
211 This is the “force ipv4 dns name resolution” option.
213 <p class="noindent">This option has some usage constraints. It:
215 <li>must not appear in combination with any of the following options:
219 <p>Force DNS resolution of following host names on the command line
220 to the IPv4 namespace.
223 <a name="ntpdc-ipv6"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-command">ntpdc command</a>,
224 Previous: <a rel="previous" accesskey="p" href="#ntpdc-ipv4">ntpdc ipv4</a>,
225 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
229 <h4 class="subsection">ipv6 option (-6)</h4>
231 <p><a name="index-ntpdc_002dipv6-5"></a>
232 This is the “force ipv6 dns name resolution” option.
234 <p class="noindent">This option has some usage constraints. It:
236 <li>must not appear in combination with any of the following options:
240 <p>Force DNS resolution of following host names on the command line
241 to the IPv6 namespace.
244 <a name="ntpdc-command"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-interactive">ntpdc interactive</a>,
245 Previous: <a rel="previous" accesskey="p" href="#ntpdc-ipv6">ntpdc ipv6</a>,
246 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
250 <h4 class="subsection">command option (-c)</h4>
252 <p><a name="index-ntpdc_002dcommand-6"></a>
253 This is the “run a command and exit” option.
254 This option takes a string argument <span class="file">cmd</span>.
256 <p class="noindent">This option has some usage constraints. It:
258 <li>may appear an unlimited number of times.
261 <p>The following argument is interpreted as an interactive format command
262 and is added to the list of commands to be executed on the specified
266 <a name="ntpdc-interactive"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-listpeers">ntpdc listpeers</a>,
267 Previous: <a rel="previous" accesskey="p" href="#ntpdc-command">ntpdc command</a>,
268 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
272 <h4 class="subsection">interactive option (-i)</h4>
274 <p><a name="index-ntpdc_002dinteractive-7"></a>
275 This is the “force ntpq to operate in interactive mode” option.
277 <p class="noindent">This option has some usage constraints. It:
279 <li>must not appear in combination with any of the following options:
280 command, listpeers, peers, showpeers.
283 <p>Force ntpq to operate in interactive mode. Prompts will be written
284 to the standard output and commands read from the standard input.
287 <a name="ntpdc-listpeers"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-numeric">ntpdc numeric</a>,
288 Previous: <a rel="previous" accesskey="p" href="#ntpdc-interactive">ntpdc interactive</a>,
289 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
293 <h4 class="subsection">listpeers option (-l)</h4>
295 <p><a name="index-ntpdc_002dlistpeers-8"></a>
296 This is the “print a list of the peers” option.
298 <p class="noindent">This option has some usage constraints. It:
300 <li>must not appear in combination with any of the following options:
304 <p>Print a list of the peers known to the server as well as a summary of
305 their state. This is equivalent to the 'listpeers' interactive command.
308 <a name="ntpdc-numeric"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-peers">ntpdc peers</a>,
309 Previous: <a rel="previous" accesskey="p" href="#ntpdc-listpeers">ntpdc listpeers</a>,
310 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
314 <h4 class="subsection">numeric option (-n)</h4>
316 <p><a name="index-ntpdc_002dnumeric-9"></a>
317 This is the “numeric host addresses” option.
318 Output all host addresses in dotted-quad numeric format rather than
319 converting to the canonical host names.
322 <a name="ntpdc-peers"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-showpeers">ntpdc showpeers</a>,
323 Previous: <a rel="previous" accesskey="p" href="#ntpdc-numeric">ntpdc numeric</a>,
324 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
328 <h4 class="subsection">peers option (-p)</h4>
330 <p><a name="index-ntpdc_002dpeers-10"></a>
331 This is the “print a list of the peers” option.
333 <p class="noindent">This option has some usage constraints. It:
335 <li>must not appear in combination with any of the following options:
339 <p>Print a list of the peers known to the server as well as a summary
340 of their state. This is equivalent to the 'peers' interactive command.
343 <a name="ntpdc-showpeers"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-config">ntpdc config</a>,
344 Previous: <a rel="previous" accesskey="p" href="#ntpdc-peers">ntpdc peers</a>,
345 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
349 <h4 class="subsection">showpeers option (-s)</h4>
351 <p><a name="index-ntpdc_002dshowpeers-11"></a>
352 This is the “show a list of the peers” option.
354 <p class="noindent">This option has some usage constraints. It:
356 <li>must not appear in combination with any of the following options:
360 <p>Print a list of the peers known to the server as well as a summary
361 of their state. This is equivalent to the 'dmpeers' interactive command.
365 <a name="ntpdc-config"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-exit-status">ntpdc exit status</a>,
366 Previous: <a rel="previous" accesskey="p" href="#ntpdc-showpeers">ntpdc showpeers</a>,
367 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
371 <h4 class="subsection">presetting/configuring ntpdc</h4>
373 <p>Any option that is not marked as <i>not presettable</i> may be preset by
374 loading values from configuration ("rc" or "ini") files, and values from environment variables named <code>NTPDC</code> and <code>NTPDC_<OPTION_NAME></code>. <code><OPTION_NAME></code> must be one of
375 the options listed above in upper case and segmented with underscores.
376 The <code>NTPDC</code> variable will be tokenized and parsed like
377 the command line. The remaining variables are tested for existence and their
378 values are treated like option arguments.
380 <p class="noindent"><code>libopts</code> will search in 2 places for configuration files:
385 The environment variables <code>HOME</code>, and <code>PWD</code>
386 are expanded and replaced when <span class="file">ntpdc</span> runs.
387 For any of these that are plain files, they are simply processed.
388 For any that are directories, then a file named <span class="file">.ntprc</span> is searched for
389 within that directory and processed.
391 <p>Configuration files may be in a wide variety of formats.
392 The basic format is an option name followed by a value (argument) on the
393 same line. Values may be separated from the option name with a colon,
394 equal sign or simply white space. Values may be continued across multiple
395 lines by escaping the newline with a backslash.
397 <p>Multiple programs may also share the same initialization file.
398 Common options are collected at the top, followed by program specific
399 segments. The segments are separated by lines like:
400 <pre class="example"> [NTPDC]
402 <p class="noindent">or by
403 <pre class="example"> <?program ntpdc>
405 <p class="noindent">Do not mix these styles within one configuration file.
407 <p>Compound values and carefully constructed string values may also be
408 specified using XML syntax:
409 <pre class="example"> <option-name>
410 <sub-opt>...&lt;...&gt;...</sub-opt>
413 <p class="noindent">yielding an <code>option-name.sub-opt</code> string value of
414 <pre class="example"> "...<...>..."
416 <p><code>AutoOpts</code> does not track suboptions. You simply note that it is a
417 hierarchicly valued option. <code>AutoOpts</code> does provide a means for searching
418 the associated name/value pair list (see: optionFindValue).
420 <p>The command line options relating to configuration and/or usage help are:
422 <h5 class="subsubheading">version (-)</h5>
424 <p>Print the program version to standard out, optionally with licensing
425 information, then exit 0. The optional argument specifies how much licensing
426 detail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument.
427 Only the first letter of the argument is examined:
430 <dt><span class="samp">version</span><dd>Only print the version. This is the default.
431 <br><dt><span class="samp">copyright</span><dd>Name the copyright usage licensing terms.
432 <br><dt><span class="samp">verbose</span><dd>Print the full copyright usage licensing terms.
437 <a name="ntpdc-exit-status"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-Usage">ntpdc Usage</a>,
438 Previous: <a rel="previous" accesskey="p" href="#ntpdc-config">ntpdc config</a>,
439 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
443 <h4 class="subsection">ntpdc exit status</h4>
445 <p>One of the following exit values will be returned:
447 <dt><span class="samp">0 (EXIT_SUCCESS)</span><dd>Successful program execution.
448 <br><dt><span class="samp">1 (EXIT_FAILURE)</span><dd>The operation failed or the command syntax was not valid.
449 <br><dt><span class="samp">66 (EX_NOINPUT)</span><dd>A specified configuration file could not be loaded.
450 <br><dt><span class="samp">70 (EX_SOFTWARE)</span><dd>libopts had an internal operational error. Please report
451 it to autogen-users@lists.sourceforge.net. Thank you.
455 <a name="ntpdc-Usage"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-See-Also">ntpdc See Also</a>,
456 Previous: <a rel="previous" accesskey="p" href="#ntpdc-exit-status">ntpdc exit status</a>,
457 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
461 <h4 class="subsection">ntpdc Usage</h4>
465 <a name="ntpdc-See-Also"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-Authors">ntpdc Authors</a>,
466 Previous: <a rel="previous" accesskey="p" href="#ntpdc-Usage">ntpdc Usage</a>,
467 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
471 <h4 class="subsection">ntpdc See Also</h4>
475 <a name="ntpdc-Authors"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-Bugs">ntpdc Bugs</a>,
476 Previous: <a rel="previous" accesskey="p" href="#ntpdc-See-Also">ntpdc See Also</a>,
477 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
481 <h4 class="subsection">ntpdc Authors</h4>
485 <a name="ntpdc-Bugs"></a>Previous: <a rel="previous" accesskey="p" href="#ntpdc-Authors">ntpdc Authors</a>,
486 Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
490 <h4 class="subsection">ntpdc Bugs</h4>
498 <!-- node-name, next, previous, up -->
499 <h3 class="section">Usage</h3>
501 <p>The simplest use of this program is as an unprivileged command to
502 check the current time, offset, and error in the local clock.
505 <pre class="example"> ntpdc ntpserver.somewhere
507 <p>With suitable privilege, it can be run as a command or in a
508 <code>cron</code> job to reset the local clock from a reliable server, like
509 the <code>ntpdate</code> and <code>rdate</code> commands.
512 <pre class="example"> ntpdc -a ntpserver.somewhere