3

I am using the following command to synchronise the time on a Oracle Linux 6.5:

ntpd -gq

Unfortunately it does not timeout when an Internet connection is not available. Is this possible or should implement my own timeout mechanism?

Thomas Bratt
  • 355
  • 2
  • 6
  • 16

2 Answers2

5

If you're on an intermittently connected machine like a laptop, consider using something other than ntpd, such as chrony, which is designed for situations like this. It is available in EPEL for RHEL 6 and is the default NTP client/server in RHEL 7.

To accomplish this, set the offline option on the servers in your chrony.conf file, and then run the chronyc online command whenever you connect to the Internet.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
0

use ntpdate, such as:

ntpdate -t 10 cn.pool.ntp.org
tangxinfa
  • 211
  • 2
  • 4