Next: ntpdc Description, Previous: (dir), Up: (dir)
This document describes the use of the NTP Project’s ntpdc
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.
This document applies to version 4.2.8p15 of ntpdc
.
The program implements the SNTP protocol as defined by RFC 5905, the NTPv4 IETF specification.
• ntpdc Description: | Description | |
• ntpdc Invocation: | Invoking ntpdc | |
• Usage: | Usage |
Next: ntpdc Invocation, Up: Top
By default, ntpdc
writes the local data and time (i.e., not UTC) to the
standard output in the format:
1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs
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.
• ntpdc Invocation: | ||
• Usage: |
Next: Usage, Previous: ntpdc Description, Up: ntpdc Description
ntpdc
is deprecated.
Please use
ntpq(1ntpqmdoc)
instead - it can do everything
ntpdc
used to do, and it does so using a much more sane interface.
ntpdc
is a utility program used to query
ntpd(1ntpdmdoc)
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
ntpdc
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
ntpdc
This section was generated by AutoGen,
using the agtexi-cmd
template and the option descriptions for the ntpdc
program.
This software is released under the NTP license, <http://ntp.org/license>.
• ntpdc usage: | ntpdc help/usage (--help) | |
• ntpdc ipv4: | ipv4 option (-4) | |
• ntpdc ipv6: | ipv6 option (-6) | |
• ntpdc command: | command option (-c) | |
• ntpdc interactive: | interactive option (-i) | |
• ntpdc listpeers: | listpeers option (-l) | |
• ntpdc numeric: | numeric option (-n) | |
• ntpdc peers: | peers option (-p) | |
• ntpdc showpeers: | showpeers option (-s) | |
• ntpdc config: | presetting/configuring ntpdc | |
• ntpdc exit status: | exit status | |
• ntpdc Usage: | Usage | |
• ntpdc See Also: | See Also | |
• ntpdc Authors: | Authors | |
• ntpdc Bugs: | Bugs |
Next: ntpdc ipv4, Up: ntpdc Invocation
This is the automatically generated usage text for ntpdc.
The text printed is the same whether selected with the help
option
(--help) or the more-help
option (--more-help). more-help
will print
the usage text by passing it through a pager program.
more-help
is disabled on platforms without a working
fork(2)
function. The PAGER
environment variable is
used to select the program, defaulting to more. Both will exit
with a status code of 0.
ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p15 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>
Next: ntpdc ipv6, Previous: ntpdc usage, Up: ntpdc Invocation
This is the “force ipv4 dns name resolution” option.
This option has some usage constraints. It:
Force DNS resolution of following host names on the command line to the IPv4 namespace.
Next: ntpdc command, Previous: ntpdc ipv4, Up: ntpdc Invocation
This is the “force ipv6 dns name resolution” option.
This option has some usage constraints. It:
Force DNS resolution of following host names on the command line to the IPv6 namespace.
Next: ntpdc interactive, Previous: ntpdc ipv6, Up: ntpdc Invocation
This is the “run a command and exit” option. This option takes a string argument cmd.
This option has some usage constraints. It:
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).
Next: ntpdc listpeers, Previous: ntpdc command, Up: ntpdc Invocation
This is the “force ntpq to operate in interactive mode” option.
This option has some usage constraints. It:
Force ntpq to operate in interactive mode. Prompts will be written to the standard output and commands read from the standard input.
Next: ntpdc numeric, Previous: ntpdc interactive, Up: ntpdc Invocation
This is the “print a list of the peers” option.
This option has some usage constraints. It:
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.
Next: ntpdc peers, Previous: ntpdc listpeers, Up: ntpdc Invocation
This is the “numeric host addresses” option. Output all host addresses in dotted-quad numeric format rather than converting to the canonical host names.
Next: ntpdc showpeers, Previous: ntpdc numeric, Up: ntpdc Invocation
This is the “print a list of the peers” option.
This option has some usage constraints. It:
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.
Next: ntpdc config, Previous: ntpdc peers, Up: ntpdc Invocation
This is the “show a list of the peers” option.
This option has some usage constraints. It:
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.
Next: ntpdc exit status, Previous: ntpdc showpeers, Up: ntpdc Invocation
Any option that is not marked as not presettable may be preset by
loading values from configuration ("rc" or "ini") files, and values from environment variables named NTPDC
and NTPDC_<OPTION_NAME>
. <OPTION_NAME>
must be one of
the options listed above in upper case and segmented with underscores.
The NTPDC
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.
libopts
will search in 2 places for configuration files:
The environment variables HOME
, and PWD
are expanded and replaced when ntpdc runs.
For any of these that are plain files, they are simply processed.
For any that are directories, then a file named .ntprc is searched for
within that directory and processed.
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.
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:
[NTPDC]
or by
<?program ntpdc>
Do not mix these styles within one configuration file.
Compound values and carefully constructed string values may also be specified using XML syntax:
<option-name> <sub-opt>...<...>...</sub-opt> </option-name>
yielding an option-name.sub-opt
string value of
"...<...>..."
AutoOpts
does not track suboptions. You simply note that it is a
hierarchicly valued option. AutoOpts
does provide a means for searching
the associated name/value pair list (see: optionFindValue).
The command line options relating to configuration and/or usage help are:
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:
Only print the version. This is the default.
Name the copyright usage licensing terms.
Print the full copyright usage licensing terms.
Next: ntpdc Usage, Previous: ntpdc config, Up: ntpdc Invocation
One of the following exit values will be returned:
Successful program execution.
The operation failed or the command syntax was not valid.
A specified configuration file could not be loaded.
libopts had an internal operational error. Please report it to autogen-users@lists.sourceforge.net. Thank you.
Next: ntpdc See Also, Previous: ntpdc exit status, Up: ntpdc Invocation
Next: ntpdc Authors, Previous: ntpdc Usage, Up: ntpdc Invocation
Next: ntpdc Bugs, Previous: ntpdc See Also, Up: ntpdc Invocation
Previous: ntpdc Authors, Up: ntpdc Invocation
Previous: ntpdc Invocation, Up: ntpdc Description
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:
ntpdc ntpserver.somewhere
With suitable privilege, it can be run as a command or in a
cron
job to reset the local clock from a reliable server, like
the ntpdate
and rdate
commands.
For example:
ntpdc -a ntpserver.somewhere