This is a really, really bad idea. Let me (try to) explain.
The ntp
daemon expects to control the system clock. When it starts it will jump the clock if permitted, so that the time approximates that offered by its remote time servers. Thereafter, it regularly compares local time generated by the system clock to that offered remotely, and tweaks the local clock faster or slower to keep it synchronised.
There are two levels of synchronisation:
- Keeping the clock accurate when compared to remote time servers
- Ensuring that over longer time periods the local clock can be sufficiently disciplined that even without Internet connectivity it will continue to keep approximately accurate time
If you jump the clock, or introduce a new slew by setting the clock (whether with ntpdate
or manually) it will upset the long-term calculations for #2 and can potentially cause the clock to be disciplined so badly that it will lose or gain visibly significant time compared to reality. If this happens then the only real solution is to shut down ntp
, delete the reference adjustment file, and hard reboot the server. Really.
If you really still want to proceed, you could try this:
ntpdate -u $(awk '$1=="server" {print $2}' /etc/ntp.conf)
But I do not recommend it under any circumstances while ntp
is still running.
ntpdate <anyhost>
withntpd -g -q
above so that you actually use ntpd's configuration to do the force update. – Josip Rodin Jun 26 '15 at 19:24