強制クロニー時間チェック

強制クロニー時間チェック

コンテクスト:

  • セントロス7.0

  • chronyc (chrony) バージョン 3.1 (+READLINE +IPV6 +DEBUG)


問題

したいchronyd にハードウェア クロックを即座に変更させる方法を見つける待たずに。

プログラムはchronyd現在私のマシン上で実行されています:

[root@localhost ~]# ps -ef | grep chronyd
   chrony     599     1  0 21:59 ?        00:00:00 /usr/sbin/chronyd
   root      6710  4779  0 22:31 pts/0    00:00:00 grep --color=auto chron

chronyd実際にはファイル内で次のように設定されています/etc/chrony.conf:

   # Record the rate at which the system clock gains/losses time.
   driftfile /var/lib/chrony/drift

   # Allow the system clock to be stepped in the first three updates
   # if its offset is larger than 1 second.
   makestep 1.0 3

   # Enable kernel synchronization of the real-time clock (RTC).
   rtcsync

   # Enable hardware timestamping on all interfaces that support it.
   hwtimestamp *

   # Increase the minimum number of selectable sources required to adjust
   # the system clock.
   #minsources 2

   # Allow NTP client access from local network.
   allow 192.168.0.0/16

   # Ignore stratum in source selection.
   stratumweight 0

   # Specify directory for log files.
   logdir /var/log/chrony

   # Select which information is logged.
   #log measurements statistics tracking
   pool chronos.univ-brest.fr

マシンが現在要求している NTP ホストは次の通りでありchronos.univ-brest.fr、マシンはそれに ping を実行できます:

 [root@localhost ~]# ping chronos.univ-brest.fr
   PING chronos.univ-brest.fr (195.83.247.18) 56(84) bytes of data.
   64 bytes from chronos.univ-brest.fr (195.83.247.18): icmp_seq=1 ttl=239 time=38.3 ms
   64 bytes from chronos.univ-brest.fr (195.83.247.18): icmp_seq=2 ttl=239 time=38.7 ms

私が見つけた唯一の類似投稿では問題は解決されませんでしたhttps://stackoverflow.com/questions/49730407/how-to-resynchronize-with-chrony


マシンの現在の日付は次のとおりです。

[root@localhost ~]# date
   jeu. févr.  2 22:40:21 CET 1978

chronydハードウェア クロックを NTP ホストによって指定された日付に強制的に即時に変更する方法を見つけたいと思います。

答え1

chronyd がまだ実行されていない場合は、「ntpdate pool.ntp.org」に似たコマンドは次のようになります (バージョン 1.30 以降)。

chronyd -q 'server pool.ntp.org iburst'

すでに実行されていて、いくつかのサーバーが構成されている場合、同等のものは次のようになります。

chronyc -a 'burst 4/4'

より大きなオフセットがあり、chrony.conf に無制限の makestep ディレクティブが含まれていない場合に、chronyd にスルーではなくクロックのステップも実行させたい場合は、新しい測定が行われるまで待ってから、chronyd にステップを実行するように指示する必要があります。

sleep 10
chronyc -a makestep

関連情報