NAME
ntpdate - set the date and time via NTP
通过NTP设置日期和时间
Disclaimer: The functionality of this program is now available
in the ntpd program. See the -q command line option in the ntpd
- Network Time Protocol (NTP) daemon page. After a suitable
period of mourning, the ntpdate program is to be retired from
this distribution
ntpdate sets the local date and time by polling the Network
Time Protocol (NTP) server(s) given as the server arguments to
determine the correct time. It must be run as root on the local
host. A number of samples are obtained from each of the servers
specified and a subset of the NTP clock filter and selection
algorithms are applied to select the best of these. Note that
the accuracy and reliability of ntpdate depends on the number
of servers, the number of polls each time it is run and the
interval between runs.
SYNOPSIS
ntpdate [ -46bBdqsuv ] [ -a key ] [ -e authdelay ] [ -k keyfile
] [ -o version ] [ -p samples ] [ -t timeout ] [ -U user_name ]
server [ … ]
DESCRIPTION
ntpdate sets the local date and time by polling the Network
Time Protocol (NTP) server(s) given as the server arguments to
determine the correct time. It must be run as root on the local
host. A number of samples are obtained from each of the servers
specified and a subset of the NTP clock filter and selection
algorithms are applied to select the best of these. Note that
the accuracy and reliability of ntpdate depends on the number
of servers, the number of polls each time it is run and the
interval between runs.
ntpdate通过轮询网络设置本地日期和时间
作为服务器参数给定的时间协议(NTP)服务器
确定正确的时间。 它必须作为root在本地运行
主办。 从每个服务器获得多个样本
指定和NTP时钟滤波器和选择的子集
应用算法来选择这些中的最好的。 注意
ntpdate的准确性和可靠性取决于数量
的服务器数,每次运行时的轮询数
间隔。
ntpdate can be run manually as necessary to set the host clock,
or it can be run from the host startup script to set the clock
at boot time. This is useful in some cases to set the clock
initially before starting the NTP daemon ntpd. It is also pos-
sible to run ntpdate from a cron script. However, it is impor-
tant to note that ntpdate with contrived cron scripts is no
substitute for the NTP daemon, which uses sophisticated algo-
rithms to maximize accuracy and reliability while minimizing
resource use. Finally, since ntpdate does not discipline the
host clock frequency as does ntpd, the accuracy using ntpdate
is limited.
ntpdate可以手动运行,根据需要设置主机时钟,
或者可以从主机启动脚本运行以设置时钟
在启动时。 这在某些情况下用于设置时钟是有用的
最初在启动NTP守护进程ntpd之前。 它也是pos-
sible从cron脚本运行ntpdate。 然而,
注意ntpdate与设计的cron脚本是没有
替代NTP守护进程,它使用复杂的算法 -
算法来最大限度地提高精度和可靠性,同时最小化
资源使用。 最后,因为ntpdate不管
主机时钟频率与ntpd一样,精度使用ntpdate
是有限的。
Time adjustments are made by ntpdate in one of two ways. If
ntpdate determines the clock is in error more than 0.5 second
it will simply step the time by calling the system settimeof-
day() routine. If the error is less than 0.5 seconds, it will
slew the time by calling the system adjtime() routine. The lat-
ter technique is less disruptive and more accurate when the
error is small, and works quite well when ntpdate is run by
cron every hour or two.
时间调整由ntpdate以两种方式之一进行。 如果
ntpdate确定时钟误差大于0.5秒
它将简单地通过调用系统的时间settimeof-
day()例程。 如果误差小于0.5秒,它将
通过调用系统adjtime()例程来转换时间。 另外,
ter技术是较少破坏性和更准确的时候
错误很小,并且在运行ntpdate时工作得很好
cron每一小时或两个。
ntpdate will decline to set the date if an NTP server daemon
(e.g., ntpd) is running on the same host. When running ntpdate
on a regular basis from cron as an alternative to running a
daemon, doing so once every hour or two will result in precise
enough timekeeping to avoid stepping the clock.
如果是NTP服务器守护程序,ntpdate将拒绝设置日期
(例如,ntpd)在同一主机上运行。 运行ntpdate时
定期从cron作为替代运行a
守护进程,这样做每一小时或两个将导致精确
足够的计时,以避免步进时钟。
Note that in contexts where a host name is expected, a -4 qual-
ifier preceding the host name forces DNS resolution to the IPv4
namespace, while a -6 qualifier forces DNS resolution to the
IPv6 namespace.
请注意,在需要主机名的上下文中,-4 qual-
ifier在主机名之前强制DNS解析到IPv4
命名空间,而-6限定符强制DNS解析
IPv6命名空间。
If NetInfo support is compiled into ntpdate, then the server
argument is optional if ntpdate can find a time server in the
NetInfo configuration for ntpd.
如果NetInfo支持编译成ntpdate,那么服务器
参数是可选的,如果ntpdate可以在中找到一个时间服务器
ntpd的NetInfo配置。
COMMAND LINE OPTIONS
-4 Force DNS resolution of following host names on the
command line to the IPv4 namespace.
-6 Force DNS resolution of following host names on the
command line to the IPv6 namespace.
命令行选项
-4强制以下主机名的DNS解析
命令行到IPv4命名空间。
-6强制以下主机名的DNS解析
命令行到IPv6命名空间。
-a key Enable the authentication function and specify the key
identifier to be used for authentication as the argu-
ment key. The keys and key identifiers must match in
both the client and server key files. The default is to
disable the authentication function.
-a key启用身份验证功能并指定密钥
标识符用于认证,
密钥。 键和键标识符必须匹配
客户端和服务器密钥文件。 默认为
禁用身份验证功能。
-B Force the time to always be slewed using the adjtime()
system call, even if the measured offset is greater
than +-500 ms. The default is to step the time using
settimeofday() if the offset is greater than +-500 ms.
Note that, if the offset is much greater than +-500 ms
in this case, that it can take a long time (hours) to
slew the clock to the correct value. During this time.
the host should not be used to synchronize clients.
-B强制时间总是使用adjtime()
系统调用,即使测量的偏移量较大
+ 500ms。 默认是使用的步进时间
settimeofday()如果偏移大于+ - 500 ms。
注意,如果偏移远大于±500ms
在这种情况下,它可能需要很长时间(小时)
将时钟转换为正确的值。 在这段时间。
主机不应该用于同步客户端。
-b Force the time to be stepped using the settimeofday()
system call, rather than slewed (default) using the
adjtime() system call. This option should be used when
called from a startup file at boot time.
翻译
-b Force the time to be stepped using the settimeofday()
system call, rather than slewed (default) using the
adjtime() system call. This option should be used when
called from a startup file at boot time.
-b使用settimeofday()强制步进的时间,
系统调用,而不是slewed(默认)使用
adjtime()系统调用。 这个选项应该在什么时候使用
在启动时从启动文件调用。
-d Enable the debugging mode, in which ntpdate will go
through all the steps, but not adjust the local clock.
Information useful for general debugging will also be
printed.
-d启用调试模式,ntpdate将在其中运行
通过所有步骤,但不调整本地时钟。
有用的一般调试信息也将
印刷。
-e authdelay
Specify the processing delay to perform an authentica-
tion function as the value authdelay, in seconds and
fraction (see ntpd for details). This number is usually
small enough to be negligible for most purposes, though
specifying a value may improve timekeeping on very slow
CPU’s.
-a authdelay
指定处理延迟,
函数作为值authdelay,以秒和
分数(详见ntpd)。 这个数字通常
足够小到可以忽略大多数目的,虽然
指定值可能会改善计时非常缓慢
CPU的。
-k keyfile
Specify the path for the authentication key file as the
string keyfile. The default is /etc/ntp/keys. This file
should be in the format described in ntpd.
-k keyfile
将验证密钥文件的路径指定为
字符串密钥文件。 默认值为/ etc / ntp / keys。 这个文件
应该采用ntpd中描述的格式。
-o version
Specify the NTP version for outgoing packets as the
integer version, which can be 1 or 2. The default is 4.
This allows ntpdate to be used with older NTP versions.
-o版本
指定输出报文的NTP版本为
整数版本,可以是1或2.默认值为4。
这允许ntpdate用于较旧的NTP版本。
-p samples
Specify the number of samples to be acquired from each
server as the integer samples, with values from 1 to 8
inclusive. The default is 4.
-p样本
指定要从每个采集的样本数
服务器作为整数样本,值为1到8
包括的。 默认值为4。
-q Query only - don’t set the clock.
-s Divert logging output from the standard output
(default) to the system syslog facility. This is
designed primarily for convenience of cron scripts.
-q仅查询 - 不设置时钟。
-s从标准输出转移日志输出
(默认)到系统syslog设施。 这是
主要为方便cron脚本而设计。
-t timeout
Specify the maximum time waiting for a server response
as the value timeout, in seconds and fraction. The
value is is rounded to a multiple of 0.2 seconds. The
default is 1 second, a value suitable for polling
across a LAN.
-u Direct ntpdate to use an unprivileged port for outgoing
packets. This is most useful when behind a firewall
that blocks incoming traffic to privileged ports, and
you want to synchronize with hosts beyond the firewall.
Note that the -d option always uses unprivileged ports.
-t超时
指定等待服务器响应的最长时间
作为值超时,以秒和分数。 的
值将舍入为0.2秒的倍数。 的
默认为1秒,一个适合轮询的值
通过LAN。
-u Direct ntpdate将非特权端口用于传出
数据包。 这在防火墙后面是最有用的
阻塞到特权端口的入站流量,以及
您希望与防火墙之外的主机同步。
请注意,-d选项始终使用非特权端口。
-v Be verbose. This option will cause ntpdate’s version
identification string to be logged.
-U user_name
ntpdate process drops root privileges and changes user
ID to user_name and group ID to the primary group of
server_user.
-v详细。 此选项将导致ntpdate的版本
要记录的标识字符串。
-U user_name
ntpdate进程删除root权限和更改用户
ID为user_name,组ID为主组
server_user。
FILES
/etc/ntp/keys - encryption keys used by ntpdate.
BUGS
The slew adjustment is actually 50% larger than the measured
offset, since this (it is argued) will tend to keep a badly
drifting clock more accurate. This is probably not a good idea
and may cause a troubling hunt for some values of the kernel
variables tick and tickadj.
文件
/ etc / ntp / keys - ntpdate使用的加密密钥。
BUGS
旋转调节实际上比测量值大50%
偏移,因为这(被争论)将倾向于保持不好
漂移时钟更准确。 这可能不是一个好主意
并且可能导致对内核的某些值的故障搜索
变量tick和tickadj。
SEE ALSO
ntpd(8)
Primary source of documentation: /usr/share/doc/ntp-*
This file was automatically generated from HTML source.
也可以看看
ntpd(8)
主要文档来源:/ usr / share / doc / ntp- *