<html lang="en">
<head>
<title>ntpdc: NTPD Control User's Manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="ntpdc: NTPD Control User's Manual">
<meta name="generator" content="makeinfo 4.7">
<link title="Top" rel="top" href="#Top">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family: serif; font-weight: normal; }
--></style>
</head>
<body>
<h1 class="settitle">ntpdc: NTPD Control User's Manual</h1>
<div class="node">
<p><hr>
<a name="Top"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-Description">ntpdc Description</a>,
Previous: <a rel="previous" accesskey="p" href="#dir">(dir)</a>,
Up: <a rel="up" accesskey="u" href="#dir">(dir)</a>
<br>
</div>
<h2 class="unnumbered">ntpdc: NTPD Control User Manual</h2>
<p>This document describes the use of the NTP Project's <code>ntpdc</code> program,
that can be used to query a Network Time Protocol (NTP) server and
display the time offset of the system clock relative to the server
clock. Run as root, it can correct the system clock to this offset as
well. It can be run as an interactive command or from a cron job.
<p>This document applies to version 4.2.8p12 of <code>ntpdc</code>.
<p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
IETF specification.
<div class="shortcontents">
<h2>Short Contents</h2>
<ul>
<a href="#Top">ntpdc: NTPD Control User Manual</a>
</ul>
</div>
<ul class="menu">
<li><a accesskey="1" href="#ntpdc-Description">ntpdc Description</a>: Description
<li><a accesskey="2" href="#ntpdc-Invocation">ntpdc Invocation</a>: Invoking ntpdc
<li><a accesskey="3" href="#Usage">Usage</a>: Usage
</ul>
<div class="node">
<p><hr>
<a name="ntpdc-Description"></a>
<br>
</div>
<!-- node-name, next, previous, up -->
<h3 class="section">Description</h3>
<p>By default, <code>ntpdc</code> writes the local data and time (i.e., not UTC) to the
standard output in the format:
<pre class="example"> 1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs
</pre>
<p>where
YYYY-MM-DD HH:MM:SS.SUBSEC is the local date and time,
(+0800) is the local timezone adjustment (so we would add 8 hours and 0 minutes to convert the reported local time to UTC),
and
the +4.567 +/- 0.089 secs indicates the time offset and
error bound of the system clock relative to the server clock.
<div class="node">
<p><hr>
<a name="ntpdc-Invocation"></a>
<br>
</div>
<h3 class="section">Invoking ntpdc</h3>
<p><a name="index-ntpdc-1"></a><a name="index-vendor_002dspecific-NTPD-control-program-2"></a>
<p><code>ntpdc</code>
is deprecated.
Please use
<code>ntpq(1ntpqmdoc)</code> instead - it can do everything
<code>ntpdc</code>
used to do, and it does so using a much more sane interface.
<p><code>ntpdc</code>
is a utility program used to query
<code>ntpd(1ntpdmdoc)</code>
about its
current state and to request changes in that state.
It uses NTP mode 7 control message formats described in the source code.
The program may
be run either in interactive mode or controlled using command line
arguments.
Extensive state and statistics information is available
through the
<code>ntpdc</code>
interface.
In addition, nearly all the
configuration options which can be specified at startup using
ntpd's configuration file may also be specified at run time using
<code>ntpdc</code>
<p>This section was generated by <strong>AutoGen</strong>,
using the <code>agtexi-cmd</code> template and the option descriptions for the <code>ntpdc</code> program.
This software is released under the NTP license, <http://ntp.org/license>.
<ul class="menu">
<li><a accesskey="1" href="#ntpdc-usage">ntpdc usage</a>: ntpdc help/usage (<span class="option">--help</span>)
<li><a accesskey="2" href="#ntpdc-ipv4">ntpdc ipv4</a>: ipv4 option (-4)
<li><a accesskey="3" href="#ntpdc-ipv6">ntpdc ipv6</a>: ipv6 option (-6)
<li><a accesskey="4" href="#ntpdc-command">ntpdc command</a>: command option (-c)
<li><a accesskey="5" href="#ntpdc-interactive">ntpdc interactive</a>: interactive option (-i)
<li><a accesskey="6" href="#ntpdc-listpeers">ntpdc listpeers</a>: listpeers option (-l)
<li><a accesskey="7" href="#ntpdc-numeric">ntpdc numeric</a>: numeric option (-n)
<li><a accesskey="8" href="#ntpdc-peers">ntpdc peers</a>: peers option (-p)
<li><a accesskey="9" href="#ntpdc-showpeers">ntpdc showpeers</a>: showpeers option (-s)
<li><a href="#ntpdc-config">ntpdc config</a>: presetting/configuring ntpdc
<li><a href="#ntpdc-exit-status">ntpdc exit status</a>: exit status
<li><a href="#ntpdc-Usage">ntpdc Usage</a>: Usage
<li><a href="#ntpdc-See-Also">ntpdc See Also</a>: See Also
<li><a href="#ntpdc-Authors">ntpdc Authors</a>: Authors
<li><a href="#ntpdc-Bugs">ntpdc Bugs</a>: Bugs
</ul>
<div class="node">
<p><hr>
<a name="ntpdc-usage"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-ipv4">ntpdc ipv4</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">ntpdc help/usage (<span class="option">--help</span>)</h4>
<p><a name="index-ntpdc-help-3"></a>
This is the automatically generated usage text for ntpdc.
<p>The text printed is the same whether selected with the <code>help</code> option
(<span class="option">--help</span>) or the <code>more-help</code> option (<span class="option">--more-help</span>). <code>more-help</code> will print
the usage text by passing it through a pager program.
<code>more-help</code> is disabled on platforms without a working
<code>fork(2)</code> function. The <code>PAGER</code> environment variable is
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
<pre class="example">ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p12
Usage: ntpdc [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
- prohibits the option 'ipv6'
-6 no ipv6 Force IPv6 DNS name resolution
- prohibits the option 'ipv4'
-c Str command run a command and exit
- may appear multiple times
-d no debug-level Increase debug verbosity level
- may appear multiple times
-D Num set-debug-level Set the debug verbosity level
- may appear multiple times
-i no interactive Force ntpq to operate in interactive mode
- prohibits these options:
command
listpeers
peers
showpeers
-l no listpeers Print a list of the peers
- prohibits the option 'command'
-n no numeric numeric host addresses
-p no peers Print a list of the peers
- prohibits the option 'command'
-s no showpeers Show a list of the peers
- prohibits the option 'command'
opt version output version information and exit
-? no help display extended usage information and exit
-! no more-help extended usage information passed thru pager
-> opt save-opts save the option state to a config file
-< Str load-opts load options from a config file
- disabled as '--no-load-opts'
- may appear multiple times
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
The following option preset mechanisms are supported:
- reading file $HOME/.ntprc
- reading file ./.ntprc
- examining environment variables named NTPDC_*
Please send bug reports to: <http://bugs.ntp.org, bugs@ntp.org>
</pre>
<div class="node">
<p><hr>
<a name="ntpdc-ipv4"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-ipv6">ntpdc ipv6</a>,
Previous: <a rel="previous" accesskey="p" href="#ntpdc-usage">ntpdc usage</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">ipv4 option (-4)</h4>
<p><a name="index-ntpdc_002dipv4-4"></a>
This is the “force ipv4 dns name resolution” option.
<p class="noindent">This option has some usage constraints. It:
<ul>
<li>must not appear in combination with any of the following options:
ipv6.
</ul>
<p>Force DNS resolution of following host names on the command line
to the IPv4 namespace.
<div class="node">
<p><hr>
<a name="ntpdc-ipv6"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-command">ntpdc command</a>,
Previous: <a rel="previous" accesskey="p" href="#ntpdc-ipv4">ntpdc ipv4</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">ipv6 option (-6)</h4>
<p><a name="index-ntpdc_002dipv6-5"></a>
This is the “force ipv6 dns name resolution” option.
<p class="noindent">This option has some usage constraints. It:
<ul>
<li>must not appear in combination with any of the following options:
ipv4.
</ul>
<p>Force DNS resolution of following host names on the command line
to the IPv6 namespace.
<div class="node">
<p><hr>
<a name="ntpdc-command"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-interactive">ntpdc interactive</a>,
Previous: <a rel="previous" accesskey="p" href="#ntpdc-ipv6">ntpdc ipv6</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">command option (-c)</h4>
<p><a name="index-ntpdc_002dcommand-6"></a>
This is the “run a command and exit” option.
This option takes a string argument <span class="file">cmd</span>.
<p class="noindent">This option has some usage constraints. It:
<ul>
<li>may appear an unlimited number of times.
</ul>
<p>The following argument is interpreted as an interactive format command
and is added to the list of commands to be executed on the specified
host(s).
<div class="node">
<p><hr>
<a name="ntpdc-interactive"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-listpeers">ntpdc listpeers</a>,
Previous: <a rel="previous" accesskey="p" href="#ntpdc-command">ntpdc command</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">interactive option (-i)</h4>
<p><a name="index-ntpdc_002dinteractive-7"></a>
This is the “force ntpq to operate in interactive mode” option.
<p class="noindent">This option has some usage constraints. It:
<ul>
<li>must not appear in combination with any of the following options:
command, listpeers, peers, showpeers.
</ul>
<p>Force ntpq to operate in interactive mode. Prompts will be written
to the standard output and commands read from the standard input.
<div class="node">
<p><hr>
<a name="ntpdc-listpeers"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-numeric">ntpdc numeric</a>,
Previous: <a rel="previous" accesskey="p" href="#ntpdc-interactive">ntpdc interactive</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">listpeers option (-l)</h4>
<p><a name="index-ntpdc_002dlistpeers-8"></a>
This is the “print a list of the peers” option.
<p class="noindent">This option has some usage constraints. It:
<ul>
<li>must not appear in combination with any of the following options:
command.
</ul>
<p>Print a list of the peers known to the server as well as a summary of
their state. This is equivalent to the 'listpeers' interactive command.
<div class="node">
<p><hr>
<a name="ntpdc-numeric"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-peers">ntpdc peers</a>,
Previous: <a rel="previous" accesskey="p" href="#ntpdc-listpeers">ntpdc listpeers</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">numeric option (-n)</h4>
<p><a name="index-ntpdc_002dnumeric-9"></a>
This is the “numeric host addresses” option.
Output all host addresses in dotted-quad numeric format rather than
converting to the canonical host names.
<div class="node">
<p><hr>
<a name="ntpdc-peers"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-showpeers">ntpdc showpeers</a>,
Previous: <a rel="previous" accesskey="p" href="#ntpdc-numeric">ntpdc numeric</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">peers option (-p)</h4>
<p><a name="index-ntpdc_002dpeers-10"></a>
This is the “print a list of the peers” option.
<p class="noindent">This option has some usage constraints. It:
<ul>
<li>must not appear in combination with any of the following options:
command.
</ul>
<p>Print a list of the peers known to the server as well as a summary
of their state. This is equivalent to the 'peers' interactive command.
<div class="node">
<p><hr>
<a name="ntpdc-showpeers"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-config">ntpdc config</a>,
Previous: <a rel="previous" accesskey="p" href="#ntpdc-peers">ntpdc peers</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">showpeers option (-s)</h4>
<p><a name="index-ntpdc_002dshowpeers-11"></a>
This is the “show a list of the peers” option.
<p class="noindent">This option has some usage constraints. It:
<ul>
<li>must not appear in combination with any of the following options:
command.
</ul>
<p>Print a list of the peers known to the server as well as a summary
of their state. This is equivalent to the 'dmpeers' interactive command.
<div class="node">
<p><hr>
<a name="ntpdc-config"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-exit-status">ntpdc exit status</a>,
Previous: <a rel="previous" accesskey="p" href="#ntpdc-showpeers">ntpdc showpeers</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">presetting/configuring ntpdc</h4>
<p>Any option that is not marked as <i>not presettable</i> may be preset by
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
the options listed above in upper case and segmented with underscores.
The <code>NTPDC</code> variable will be tokenized and parsed like
the command line. The remaining variables are tested for existence and their
values are treated like option arguments.
<p class="noindent"><code>libopts</code> will search in 2 places for configuration files:
<ul>
<li>$HOME
<li>$PWD
</ul>
The environment variables <code>HOME</code>, and <code>PWD</code>
are expanded and replaced when <span class="file">ntpdc</span> runs.
For any of these that are plain files, they are simply processed.
For any that are directories, then a file named <span class="file">.ntprc</span> is searched for
within that directory and processed.
<p>Configuration files may be in a wide variety of formats.
The basic format is an option name followed by a value (argument) on the
same line. Values may be separated from the option name with a colon,
equal sign or simply white space. Values may be continued across multiple
lines by escaping the newline with a backslash.
<p>Multiple programs may also share the same initialization file.
Common options are collected at the top, followed by program specific
segments. The segments are separated by lines like:
<pre class="example"> [NTPDC]
</pre>
<p class="noindent">or by
<pre class="example"> <?program ntpdc>
</pre>
<p class="noindent">Do not mix these styles within one configuration file.
<p>Compound values and carefully constructed string values may also be
specified using XML syntax:
<pre class="example"> <option-name>
<sub-opt>...&lt;...&gt;...</sub-opt>
</option-name>
</pre>
<p class="noindent">yielding an <code>option-name.sub-opt</code> string value of
<pre class="example"> "...<...>..."
</pre>
<p><code>AutoOpts</code> does not track suboptions. You simply note that it is a
hierarchicly valued option. <code>AutoOpts</code> does provide a means for searching
the associated name/value pair list (see: optionFindValue).
<p>The command line options relating to configuration and/or usage help are:
<h5 class="subsubheading">version (-)</h5>
<p>Print the program version to standard out, optionally with licensing
information, then exit 0. The optional argument specifies how much licensing
detail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument.
Only the first letter of the argument is examined:
<dl>
<dt><span class="samp">version</span><dd>Only print the version. This is the default.
<br><dt><span class="samp">copyright</span><dd>Name the copyright usage licensing terms.
<br><dt><span class="samp">verbose</span><dd>Print the full copyright usage licensing terms.
</dl>
<div class="node">
<p><hr>
<a name="ntpdc-exit-status"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-Usage">ntpdc Usage</a>,
Previous: <a rel="previous" accesskey="p" href="#ntpdc-config">ntpdc config</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">ntpdc exit status</h4>
<p>One of the following exit values will be returned:
<dl>
<dt><span class="samp">0 (EXIT_SUCCESS)</span><dd>Successful program execution.
<br><dt><span class="samp">1 (EXIT_FAILURE)</span><dd>The operation failed or the command syntax was not valid.
<br><dt><span class="samp">66 (EX_NOINPUT)</span><dd>A specified configuration file could not be loaded.
<br><dt><span class="samp">70 (EX_SOFTWARE)</span><dd>libopts had an internal operational error. Please report
it to autogen-users@lists.sourceforge.net. Thank you.
</dl>
<div class="node">
<p><hr>
<a name="ntpdc-Usage"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-See-Also">ntpdc See Also</a>,
Previous: <a rel="previous" accesskey="p" href="#ntpdc-exit-status">ntpdc exit status</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">ntpdc Usage</h4>
<div class="node">
<p><hr>
<a name="ntpdc-See-Also"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-Authors">ntpdc Authors</a>,
Previous: <a rel="previous" accesskey="p" href="#ntpdc-Usage">ntpdc Usage</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">ntpdc See Also</h4>
<div class="node">
<p><hr>
<a name="ntpdc-Authors"></a>Next: <a rel="next" accesskey="n" href="#ntpdc-Bugs">ntpdc Bugs</a>,
Previous: <a rel="previous" accesskey="p" href="#ntpdc-See-Also">ntpdc See Also</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">ntpdc Authors</h4>
<div class="node">
<p><hr>
<a name="ntpdc-Bugs"></a>Previous: <a rel="previous" accesskey="p" href="#ntpdc-Authors">ntpdc Authors</a>,
Up: <a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
<br>
</div>
<h4 class="subsection">ntpdc Bugs</h4>
<div class="node">
<p><hr>
<a name="Usage"></a>
<br>
</div>
<!-- node-name, next, previous, up -->
<h3 class="section">Usage</h3>
<p>The simplest use of this program is as an unprivileged command to
check the current time, offset, and error in the local clock.
For example:
<pre class="example"> ntpdc ntpserver.somewhere
</pre>
<p>With suitable privilege, it can be run as a command or in a
<code>cron</code> job to reset the local clock from a reliable server, like
the <code>ntpdate</code> and <code>rdate</code> commands.
For example:
<pre class="example"> ntpdc -a ntpserver.somewhere
</pre>
</body></html>