Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1741623
  • 博文数量: 297
  • 博客积分: 285
  • 博客等级: 二等列兵
  • 技术积分: 3006
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-06 22:04
个人简介

Linuxer, ex IBMer. GNU https://hmchzb19.github.io/

文章分类

全部博文(297)

文章存档

2020年(11)

2019年(15)

2018年(43)

2017年(79)

2016年(79)

2015年(58)

2014年(1)

2013年(8)

2012年(3)

分类: LINUX

2017-05-17 12:04:21

以前都用ntpdate 来同步时间,最近忽然发现还有个htpdate 命令. 
例如以前我用这个命令.

点击(此处)折叠或打开

  1. ntpdate time.nist.gov
  2. ntpdate ntp.ubuntu.com

看看htpdate的命令行.

点击(此处)折叠或打开

  1. dpkg-query -s htpdate

  2. Package: htpdate
  3. Status: install ok installed
  4. Priority: optional
  5. Section: net
  6. Installed-Size: 52
  7. Maintainer: Joao Eriberto Mota Filho <eriberto@debian.org>
  8. Architecture: amd64
  9. Version: 1.1.3-2
  10. Depends: lsb-base, libc6 (>= 2.4)
  11. Conffiles:
  12.  /etc/default/htpdate ee4267c136bbf00f9606f5946077ccd7
  13.  /etc/init.d/htpdate 8f2d2a53ebc81df4fd6143837d18fc75
  14.  /etc/network/if-up.d/htpdate 5dad40801795c589ff47c44641059afc
  15. Description: HTTP based time synchronization tool
  16.  The HTTP Time Protocol (HTP) is used to synchronize a computer
man htpdate 看了下,命令还挺复杂的

点击(此处)折叠或打开

  1. OPTIONS
  2.        -0 HTTP/1.0 request (default is HTTP/1.1).

  3.        -4 Force IPv4 name resolution only. Default behaviour is to try IPv6 first and fall back to IPv4.

  4.        -6 Force IPv6 name resolution only.

  5.        -a Adjust time smoothly (default in daemon mode).

  6.        -b Burst mode uses multiple polls for each web server to enhance accuracy.

  7.        -d Turn debug on. Shows the "raw" timestamp, round trip time, time delta and and basic statistics of web server responses. Useful to determining the quality of a specific web
  8.               server as time source.

  9.        -h Show help.

  10.        -i Set the pid file (default /var/run/htpdate.pid).

  11.        -l Use syslog for output (levels LOG_WARNING and LOG_INFO). Convenient if you use htpdate from cron.

  12.        -m -M These options specify the minimum (-m) and maximum (-M) polling intervals for HTP requests, in seconds. The default range is between 30 minutes and 32 hours. Htpdate cal‐
  13.               culates the optimal polling frequency between minimum and maximum values. Only applicable when running in daemon mode.

  14.        -p Precision (in milliseconds) specifies the operating accuracy of htpdate. Internally htpdate uses a different algorithm to detect a time offset, when precision is speci‐
  15.               fied. Precision only has effect in daemon mode. Use with caution.

  16.        -q Query web server and display time, but do not change time (default in interactive mode).

  17.        -s Set time immediate. In daemon mode -s only applies the first poll.

  18.        -t Turn off sanity time check. By default a time offset larger than a year, compared to current localtime, is rejected. With -t set, any time stamp will be accepted.

  19.        -u Set the user and group that the server normally runs at (default is root).

  20.        -x Let htpdate compensate for the systematisch clock drift.

  21.        -D Run as daemon (requires root privileges).

  22.        -m -M These options specify the minimum (-m) and maximum (-M) polling intervals for HTP requests, in seconds. The default range is between 30 minutes and 32 hours. Htpdate cal‐
  23.               culates the optimal polling frequency between minimum and maximum values. Only applicable when running in daemon mode.

  24.        -p Precision (in milliseconds) specifies the operating accuracy of htpdate. Internally htpdate uses a different algorithm to detect a time offset, when precision is speci‐
  25.               fied. Precision only has effect in daemon mode. Use with caution.

  26.        -q Query web server and display time, but do not change time (default in interactive mode).

  27.        -s Set time immediate. In daemon mode -s only applies the first poll.

  28.        -t Turn off sanity time check. By default a time offset larger than a year, compared to current localtime, is rejected. With -t set, any time stamp will be accepted.

  29.        -u Set the user and group that the server normally runs at (default is root).

  30.        -x Let htpdate compensate for the systematisch clock drift.

  31.        -D Run as daemon (requires root privileges).

  32.        -P Proxy server hostname or ip-address.

  33.        host Web server hostname or ip-address. Up to 16 hosts may be specified, but in general 3 to 5 hosts should be enough for a redundant and accurate setup.

  34.        port Portnumber (default 80 and 8080 for proxy server)

  35. EXAMPLES
  36.        Request time from web server (don't update local clock):
  37.               htpdate -q

  38.        Verbose output (don't update local clock):
  39.               htpdate -d -q www.linux.org www.freebsd.org

  40.        Adjust time smoothly and log output to syslog (eg. cron):
  41.               htpdate -a -l www.linux.org www.freebsd.org

  42.        HTTP/1.0 request in IPv6 literal format (RFC 2732):
  43.               htpdate -0 [2001:DB8:1af6::123]:80

  44.        Run htpdate as daemon:
  45.               htpdate -D www.linux.org www.freebsd.org

  46.        Daemon mode for the security minded:
  47.               htpdate -D -u nobody:nogroup www.linux.org www.freebsd.org



阅读(2252) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~