ntpdc: NTPD Control User's Manual


Next: , Previous: (dir), Up: (dir)

ntpdc: NTPD Control User Manual

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.7p181 of ntpdc.

The program implements the SNTP protocol as defined by RFC 5905, the NTPv4 IETF specification.

Short Contents



Description

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.



Invoking ntpdc

This program has no explanation.

The [+: prog-name :+] utility program is used to query an NTP daemon 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 [= prog-name =] 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 [= prog-name =] .

This section was generated by AutoGen, the aginfo template and the option descriptions for the ntpdc program. It documents the ntpdc usage text and option meanings.

This software is released under a specialized copyright license.


Next: , Up: ntpdc Invocation

ntpdc usage help (-?)

This is the automatically generated usage text for ntpdc:

ntpdc - vendor-specific NTPD control program - Ver. 4.2.7p181
USAGE:  ntpdc [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]
  Flg Arg Option-Name    Description
   -4 no  ipv4           Force IPv4 DNS name resolution
                                - prohibits these options:
                                ipv6
   -6 no  ipv6           Force IPv6 DNS name resolution
                                - prohibits these options:
                                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 Str 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 these options:
                                command
   -n no  numeric        numeric host addresses
   -p no  peers          Print a list of the peers
                                - prohibits these options:
                                command
   -s no  showpeers      Show a list of the peers
                                - prohibits these options:
                                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_*

The [+: prog-name :+] utility program is used to query an NTP daemon 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 [= prog-name =] 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 [= prog-name =]
.

please send bug reports to:  http://bugs.ntp.org, bugs@ntp.org


Next: , Previous: ntpdc usage, Up: ntpdc Invocation

command option (-c)

This is the “run a command and exit” option.

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: , Previous: ntpdc command, Up: ntpdc Invocation

debug-level option (-d)

This is the “increase debug verbosity level” option.

This option has some usage constraints. It:


Next: , Previous: ntpdc debug-level, Up: ntpdc Invocation

interactive option (-i)

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: , Previous: ntpdc interactive, Up: ntpdc Invocation

ipv4 option (-4)

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: , Previous: ntpdc ipv4, Up: ntpdc Invocation

ipv6 option (-6)

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: , Previous: ntpdc ipv6, Up: ntpdc Invocation

listpeers option (-l)

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: , Previous: ntpdc listpeers, Up: ntpdc Invocation

numeric option (-n)

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: , Previous: ntpdc numeric, Up: ntpdc Invocation

peers option (-p)

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: , Previous: ntpdc peers, Up: ntpdc Invocation

set-debug-level option (-D)

This is the “set the debug verbosity level” option.

This option has some usage constraints. It:


Previous: ntpdc set-debug-level, Up: ntpdc Invocation

showpeers option (-s)

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.



Usage

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 crom job to reset the local clock from a reliable server, like the ntpdate and rdate commands. For example:

    ntpdc -a ntpserver.somewhere