更新时间:ntpdate[3108]:NTP 套接字正在使用中,正在退出

use*_*866 81 linux terminal time ntp

由于某种原因,我系统上的时间不正确。
我需要运行更新,但我似乎无法做到
这是错误。

ntpdate pool.ntp.org
31 Aug 12:31:59 ntpdate[3108]: the NTP socket is in use, exiting
Run Code Online (Sandbox Code Playgroud)

我刚刚重新启动,我不知道怎么回事in use

小智 170

如果要ntpdatentp守护程序已经启动并运行的情况下执行,请使用以下命令:

# ntpdate -u pool.ntp.org
Run Code Online (Sandbox Code Playgroud)

它将使用不同的端口。

  • 这应该是公认的答案。这只是一个命令,因此可以节省大量时间。它对我有用并修复了多小时时钟偏差。我希望我以前知道。 (10认同)

ter*_*don 85

它正在使用中,因为该ntp服务可能正在运行。您没有提到您使用的是哪种 Linux,因此假设您已service安装(您正在运行 System V 系统):

$ sudo ntpdate pool.ntp.org
31 Aug 19:05:55 ntpdate[8911]: the NTP socket is in use, exiting
$ sudo service ntp stop
[ ok ] Stopping NTP server: ntpd.
$ sudo ntpdate pool.ntp.org
31 Aug 19:07:11 ntpdate[10355]: adjust time server 46.29.176.115 offset -0.002893 sec
$ sudo service ntp start
Run Code Online (Sandbox Code Playgroud)

  • 对于阅读上述方式的人,虽然它在技术上有效,但请查看下面的 http://superuser.com/a/639516/308927,因为它更简单(单个命令,无需停止/启动服务)。 (10认同)