0

I am using CentOS 7.4, and NTP is replaced by Chrony.

I just wonder whether Chrony has something similar to ntpdate, which can be used to synch clock per request (from command line, etc)?

Thanks in advance.

2

First, understand what software running would be seriously affected by jumps from stepping the time. It may be safer to wait until you can bring databases down.

Start chronyd, wait a few seconds for the first measurement, and make it step the remaining correction with the makestep commmand. Usually chrony.conf will contain a makestep directive to step the first updates anyway, but the makestep command can be at any time.

systemctl start chronyd
sleep 10
chronyc makestep

There is an option to set clock once and exit. Similar to ntpd -q, even is the same -q option. However, it only works while chronyd is not running, which it should be. So I prefer makestep, although the -Q option is nice to get the offset of something not in the configuration.

Does chronyd have an ntpdate mode?

Yes. With the -q option chronyd will set the system clock once and exit. With the -Q option it will print the measured offset without setting the clock. If you don’t want to use a configuration file, NTP servers can be specified on the command line. For example:

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

These are not your only options. You can trigger a burst of measurements, or wait on slew instead of stepping the time, or some combination of the above. See this chrony-users thread comparing burst and waitsync.

  • Although I have more questions around your answer, your answer did answer what I have asked in this post! I will create another post. Thanks! – Hei May 6 '18 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.