代码之家  ›  专栏  ›  技术社区  ›  jsstuball

如何列出*所有*正在运行的时间同步服务

  •  0
  • jsstuball  · 技术社区  · 6 年前

    我有一个Ubuntu框,我想设置一个NTP时间同步。决定与 chrony . 我想确保没有其他现成的时间同步服务正在运行。

    sudo service --status-all 所有的服务都没有弹出。但有没有更彻底的方法来检查是否没有运行时间同步?我不满意的原因是 timedatectl 运行中,但是它在上面的列表中没有产生任何可见的服务-好吧,无论如何也没有类似于“timedatectl”的东西。

    John:~$ timedatectl
      Local time: Sat 2018-08-18 04:29:15 UTC
      Universal time: Sat 2018-08-18 04:29:15 UTC
      RTC time: Sat 2018-08-18 04:29:15
      Time zone: Etc/UTC (UTC, +0000)
      Network time on: yes
      NTP synchronized: yes
      RTC in local TZ: no
    
    1 回复  |  直到 6 年前
        1
  •  1
  •   user3788685    6 年前

    一个选择是看看 netstat 结果并查看是否有任何绑定到 ntp 港口。

    netstat -a 你应该得到一个类似的结果如下(截断);

    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address               Foreign Address             State           
    udp        0      0 vm0:ntp                     *:*                                     
    udp        0      0 localhost.localdomain:ntp   *:*                                     
    udp        0      0 *:ntp                       *:*                                     
    udp        0      0 fe80::ffff:ffff:ffff:ffff:ntp *:*                                     
    udp        0      0 localhost.localdomain:ntp   *:*                                     
    udp        0      0 *:ntp                       *:*                                     
    

    注意带有“ntp”或任何绑定到端口123的行。这将告诉你你有一些运行和活跃的东西。我看不到允许您检查哪个程序或进程绑定到 港口 (但是您可以看到 -p