用 rdate 同步服务器时间为标准时间
May 26th, 2005
服务器采用标准的时间很重要, Linux 上的 rdate 命令可以让你和远程的时间服务器同步:
rdate -s -u time-b.nist.gov
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Oct | ||||||
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
WordPress powers 和谐,自由 :: Entries (RSS) and Comments (RSS)
张天津:unix服务器十年操作史 said:
正确命令为
rdate -s -p time-b.nist.gov
提议大家多打打–help,会受益匪浅的!
网上的教程命令绝对不能一鼓脑照拷一气!
徐永久 said:
感谢,张先生的评论,
不过这个命令并没有错的。
恐怕是我没有对 -u 这个参数作说明,是因为我在公司内部受防火墙限制,不能走 tcp ,所以需要用 -u UDP 才可以走出去。
看看 man rdate 的说明:
NAME
rdate - get the time via the network
SYNOPSIS
rdate [-p] [-s] [-u] [-l] [-t sec] [host…]
DESCRIPTION
rdate connects to an RFC 868 time server over a TCP/IP network, print-
ing the returned time and/or setting the system clock.
OPTIONS
-p Print the time returned by the remote machine.
-s Set the system time to the returned time.
-u Use UDP instead of TCP as the transport.
-l Use syslog to output errors (cron.warning) and output
(cron.info).
-t Set timeout in seconds for every attempt to retreive date.
徐永久 said:
公司的 Cisco IP 电话有显示时间,可是这个时间和 PC 一样也会错。公司的 Cisco 交换机上只要运行一个类似 rdate 的程序同步原子时钟即可解决问题。
nistime-32bit.exe 是一个很好的程序。 目前能每次启动时自动和原子时钟同步。