例如以前我用这个命令.
点击(此处)折叠或打开
- ntpdate time.nist.gov
- ntpdate ntp.ubuntu.com
看看htpdate的命令行.
点击(此处)折叠或打开
- dpkg-query -s htpdate
- Package: htpdate
- Status: install ok installed
- Priority: optional
- Section: net
- Installed-Size: 52
- Maintainer: Joao Eriberto Mota Filho <eriberto@debian.org>
- Architecture: amd64
- Version: 1.1.3-2
- Depends: lsb-base, libc6 (>= 2.4)
- Conffiles:
- /etc/default/htpdate ee4267c136bbf00f9606f5946077ccd7
- /etc/init.d/htpdate 8f2d2a53ebc81df4fd6143837d18fc75
- /etc/network/if-up.d/htpdate 5dad40801795c589ff47c44641059afc
- Description: HTTP based time synchronization tool
- The HTTP Time Protocol (HTP) is used to synchronize a computer
点击(此处)折叠或打开
- OPTIONS
- -0 HTTP/1.0 request (default is HTTP/1.1).
- -4 Force IPv4 name resolution only. Default behaviour is to try IPv6 first and fall back to IPv4.
- -6 Force IPv6 name resolution only.
- -a Adjust time smoothly (default in daemon mode).
- -b Burst mode uses multiple polls for each web server to enhance accuracy.
- -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
- server as time source.
- -h Show help.
- -i Set the pid file (default /var/run/htpdate.pid).
- -l Use syslog for output (levels LOG_WARNING and LOG_INFO). Convenient if you use htpdate from cron.
- -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‐
- culates the optimal polling frequency between minimum and maximum values. Only applicable when running in daemon mode.
- -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‐
- fied. Precision only has effect in daemon mode. Use with caution.
- -q Query web server and display time, but do not change time (default in interactive mode).
- -s Set time immediate. In daemon mode -s only applies the first poll.
- -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.
- -u Set the user and group that the server normally runs at (default is root).
- -x Let htpdate compensate for the systematisch clock drift.
- -D Run as daemon (requires root privileges).
- -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‐
- culates the optimal polling frequency between minimum and maximum values. Only applicable when running in daemon mode.
- -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‐
- fied. Precision only has effect in daemon mode. Use with caution.
- -q Query web server and display time, but do not change time (default in interactive mode).
- -s Set time immediate. In daemon mode -s only applies the first poll.
- -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.
- -u Set the user and group that the server normally runs at (default is root).
- -x Let htpdate compensate for the systematisch clock drift.
- -D Run as daemon (requires root privileges).
- -P Proxy server hostname or ip-address.
- 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.
- port Portnumber (default 80 and 8080 for proxy server)
- EXAMPLES
- Request time from web server (don't update local clock):
- htpdate -q www.linux.org www.freebsd.org
- Verbose output (don't update local clock):
- htpdate -d -q www.linux.org www.freebsd.org
- Adjust time smoothly and log output to syslog (eg. cron):
- htpdate -a -l www.linux.org www.freebsd.org
- HTTP/1.0 request in IPv6 literal format (RFC 2732):
- htpdate -0 [2001:DB8:1af6::123]:80
- Run htpdate as daemon:
- htpdate -D www.linux.org www.freebsd.org
- Daemon mode for the security minded:
- htpdate -D -u nobody:nogroup www.linux.org www.freebsd.org