首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当服务器与NTP同步时,如何保持硬件时钟的更新?

当服务器与NTP同步时,如何保持硬件时钟的更新?
EN

Server Fault用户
提问于 2016-02-23 15:39:52
回答 2查看 5.9K关注 0票数 2

当服务器与NTP服务器同步时,是否有任何方法定期同步硬件时钟?我正在使用Centos 6.7。以下是我的ntp.conf文件内容

代码语言:javascript
复制
# 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
EN

回答 2

Server Fault用户

发布于 2016-02-23 15:52:37

您可以在root的crontab中尝试以下操作:

代码语言:javascript
复制
1 0 * * *  /usr/sbin/hwclock --systohc

这将每天同步,午夜后,不要忘记--utc标志,如果你的主板时钟在世界协调时。如果您的硬件时钟漂移如此之快,它需要纠正超过一天,你可能有更大的问题!

票数 5
EN

Server Fault用户

发布于 2016-02-23 15:53:12

通常,RHEL和CentOS在ntpdate init脚本优雅重新启动和关闭期间从系统时间同步硬件时钟。

没有什么能阻止您通过从cron作业调用/sbin/hwclock --systohc来稍微频繁地这样做。

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/759215

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档