如何在不使用日期的情况下更改当地时间
它是一个远程服务器,因此没有安装 GUI 或奇特的东西,我使用 SSH 连接到该主机。 出于安全原因,我想,我无法使用“date -s”命令来更改本地服务器的当前时间。
$ cat /etc/issues ==> Ubuntu 10.04 LTS
$ uname -r ==> 2.6.32-042stab037.1
$ cat $SHELL ==> /bin/bash
“date”显示的时间早了大约 10 分钟,我尝试将正确的时间从 /usr/share/zoneinfo (在我的例子中是纽约)链接到 /etc/localtime,但没有真正改变,我的时钟仍然是 10 分钟不同步。
我是否必须使用 zic 生成新的时区二进制文件?是的?如何?不?我还能尝试什么?
提前谢谢大家。 /秒
It's a remote server so no GUI or fancy stuff installed, I connect to that host using SSH.
For security reasons I suppose, I cannot use the 'date -s' command to change the local server's current time.
$ cat /etc/issues ==> Ubuntu 10.04 LTS
$ uname -r ==> 2.6.32-042stab037.1
$ cat $SHELL ==> /bin/bash
'date' shows me time that is about 10 minutes early, I tried linking the right time from /usr/share/zoneinfo (New york in my case) to /etc/localtime, but nothing really changed, my clock is still 10 minutes unsynchronized.
Do I have to generate a new time zone binary using zic? Yes? how? no? What else could I try ?
Thanks a bunch in advance.
/s
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
adjtimex(8)
设置正在运行的系统的系统时钟。它将平滑地调整时间,不会像date
那样留下任何可怕的间隙。然而,使用它的语法完全超出了我的能力范围,所以我只是使用 ntp 并忘记它。如果重新启动后时钟问题仍然存在,您还需要使用
hwclock
重置硬件时钟。Use
adjtimex(8)
to set the system clock of a running system. It will smoothly adjust the time and not leave any scary gaps asdate
would. The syntax for using it is quite beyond me, however, so I just use ntp and forget it.If your clock issues persists accross reboots you will need to reset the hardware clock with
hwclock
as well.您是否考虑过安装 ntp 守护进程来保持时间同步以避免时间切片?
Ntpd 是一个很好的起点(它在 debian 包中提供ntp和 openntpd)
您必须设置一个服务器引用(通常是 ntp.pool.org,但您可以根据需要更改它),然后在计算机启动时启动它......并让他做这项工作(即:保持时间同步)
Did you think about installing a ntp daemon to keep your time synchronized to avoid those time slicing ?
Ntpd is a good starting point (it is provided in debian packages ntp and openntpd)
You'll have to set a server reference (usually ntp.pool.org, but you can change it if you need) and then, launch it on machine startup.... and let him do the job (ie : keep the time synchronized)