我们的比格骨黑人有个小问题。由于它们不带RTC电池,当它们失去电源时,硬件时钟就会被弄乱。我需要一个简单和干净的方式同步hwclock到系统时钟在启动。当然,系统时钟是从ntpd获得的,因此在它启动之后,系统时钟是完美的。我就在解决方案上,只需要一些建议和一点语法。
我想并试图补充:
/sbin/hwclock --systohcTo /etc/init.d/ntp (在开始案例的内部和结尾),起初这似乎有效,但现在经过几次测试,它不再起作用了,我不知道什么改变了。也许我只是觉得它成功了。
我知道-w工作得很好,我知道我可以在启动时把它放到cron工作中,但如果可以的话,我更喜欢避免cron。还有其他建议或语法变化吗?
谢谢
顺便说一句,这是关于Debian的,但是我们也需要这个在Ubuntu上工作。
发布于 2015-02-28 00:57:55
安装假hwclock程序:
# apt-get install fake-hwclock
fake-hwclock: Save/restore system clock on machines without working RTC hardware
Some machines don't have a working realtime clock (RTC) unit, or no
driver for the hardware that does exist. fake-hwclock is a simple set
of scripts to save the kernel's current clock periodically (including
at shutdown) and restore it at boot so that the system clock keeps at
least close to realtime. This will stop some of the problems that may
be caused by a system believing it has travelled in time back to
1970, such as needing to perform filesystem checks at every boot.
On top of this, use of NTP is still recommended to deal with the fake
clock "drifting" while the hardware is halted or rebooting.如果安装了假时钟,你的机器就不会再一次被认为是1970年了。当您的机器启动时,它将把它的时钟设置为在上次重新启动/关机期间编写的时间戳伪hwclock。这意味着您可以有一个稍微正确的时钟,以防在启动时出现网络问题。
https://unix.stackexchange.com/questions/187261
复制相似问题