当服务器与 NTP 服务器同步时,有没有办法定期同步硬件时钟?我正在使用 Centos 6.7。以下是我的 ntp.conf 文件内容
# File for including partners custom ntp configurations
leapfile "/etc/ntp/leap-seconds.list"
# Permit general access to this service.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1
# Replacement for the Undisciplined Local Clock. Allows a
# group of ntpds to autonomously select a leader in the
# event that all real time sources become unreachable.
tos orphan 10
# NTP Drift file.
# Put this in a directory to which the daemon can write.
# No symbolic links allowed, either, since daemon renames.
driftfile /var/lib/ntp/drift
# Key file containing the keys and key identifiers used
# when operating with symmetric key cryptography.
keys /etc/ntp/keys
# Specify the key identifiers which are trusted.
#trustedkey 4 8 42
# Specify the key identifier to use with the ntpdc utility.
#requestkey 8
# Specify the key identifier to use with the ntpq utility.
#controlkey 8
server 127.127.1.0 # local clock
server x.x.x.x
Run Code Online (Sandbox Code Playgroud)
您可以在 root 中尝试以下操作crontab:
1 0 * * * /usr/sbin/hwclock --systohc
Run Code Online (Sandbox Code Playgroud)
这将每天同步,就在午夜之后;--utc如果您的主板时钟是 UTC,请不要忘记标志。如果您的硬件时钟漂移如此之快以至于每天需要校正不止一次,那么您可能会遇到更大的问题!
| 归档时间: |
|
| 查看次数: |
4929 次 |
| 最近记录: |