This document describes the use of the NTP Project's ntp-wait
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.7p304 of ntp-wait
.
The program implements the SNTP protocol as defined by RFC 5905, the NTPv4 IETF specification.
By default, ntp-wait
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.
ntp-wait
will send at most
.Ar
num-tries
queries to
ntpd(8)
,
sleeping for
.Ar
secs-between-tries
after each status return that says
ntpd(8)
has not yet produced a synchronized and stable system clock.
ntp-wait
will do this quietly, unless the
-v
flag is provided.
This section was generated by AutoGen,
using the agtexi-cmd
template and the option descriptions for the ntp-wait
program.
This software is released under the NTP license, <http://ntp.org/license>.
This is the automatically generated usage text for ntp-wait.
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.
/deacon/backroom/snaps/ntp-dev/A.snap/scripts/ntp-wait version [unknown] calling Getopt::Std::getopts (version 1.05 [paranoid]), running under Perl version 5.8.8. Usage: ntp-wait [-OPTIONS [-MORE_OPTIONS]] [--] [PROGRAM_ARG1 ...] The following single-character options are accepted: With arguments: -n -s Boolean (without arguments): -v Options may be merged together. -- stops processing of options. Space is not required between options and their arguments. [Now continuing due to backward compatibility and excessive paranoia. See ``perldoc Getopt::Std'' about $Getopt::Std::STANDARD_HELP_VERSION.]
This is the “number of times to check ntpd” option. This option takes an argument number num-tries. The maximum number of times we will check ntpd to see if it has been able to synchronize and stabilize the system clock.
This is the “how long to sleep between tries” option. This option takes an argument number secs-between-tries. We will sleep for secs-between-tries after each query of ntpd that returns "the time is not yet stable".
This is the “be verbose” option. By default, ntp-wait is silent. With this option, ntp-wait will provide status information.
Any option that is not marked as not presettable may be preset by
loading values from environment variables named NTP-WAIT
and NTP-WAIT_<OPTION_NAME>
. <OPTION_NAME>
must be one of
the options listed above in upper case and segmented with underscores.
The NTP-WAIT
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.
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:
One of the following exit values will be returned:
.An "Harlan Stenn"
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:
ntp-wait 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:
ntp-wait -a ntpserver.somewhere