Here is our simple tip for your healthy server’s date and time:
Immediately synchronize the clock of your computer when using the openntpd (a lightweight version of ntpd with client-only mode).
Use the “-s” (lower “s” letter) to instruct the daemon ntpd to synchronize the clock immediately after it discovers a healthy time server!
-s Try to set the time immediately at startup, as opposed to slowly adjusting the clock. ntpd will stay in the foreground for up to 15 seconds waiting for one of the configured NTP servers to reply.
Find the start-up configuration file in your “/etc” (for your Linux distribution, its name is probably ntpd, for Gentoo it is “/etc/conf.d/ntpd”, the thing is to find the start-up confiuration script, not the ntpd.conf, which is the ntpd configuration file for the daemon) and include “-s” in the NTPD_OPTS:
cat /etc/conf.d/ntpd # /etc/conf.d/ntpd: config file for openntpd's ntpd NTPD_OPTS="-s"
Restart the service.
If you use it in a virtualized environment like containers (docker, lxc, lxd and so on) and qemu, virtualbox, vmware and so on and you often suspend the machine to synchronize the clock when you resume it you must manually restart the openntpd service!!! Or you are going to wait for slowly adjusting the time as usual.
There is a utility to check what’s going on with the openntpd – ntpctl. It has only three read-only commands:
usage: ntpctl -s all | peers | Sensors | status