1 Reply Latest reply: Sep 30, 2013 5:11 AM by rukbat RSS

    Best way to snyc time on a Linux machine


      I wanted to know which should be the best way to sync time for a linux machine. We have an application server and a database server, both using RHEL 5.8 as the OS. It is important that the time on both these servers match together and also sync with a common time source.  As per my knowledge, these are the 2 ways which can be explained as follows considering the common source as instructor.example.com, it can also be assumed that desktop1.example.com & desktop2.example.com are the hostnames of the other 2 machines


      1) Add a cron job with the command, ntpdate to sync with the time on instructor.example.com. The cron job could be scheduled once a day something as follows:


      * 1 * * * /usr/sbin/ntpdate -b instructor.example.com


      2) Configure the /etc/ntp.conf on the 2 machines, desktop1.example.com & desktop2.example.com to include the line like:


      server instructor.example.com


      and line


      peer desktop1.example.com


      for desktop2.example.com and vice-versa for desktop1.example.com.


      There are few observations in this also:


      1) By adding server 0.rhel.pool.ntp.org,  it should be aligning the time with a public time server but would it be reliable?

      2) By including the peer, should it help maintaining the time for desktop1.example.com &  desktop2.example.com to be close to each other. This would mean that the 3 machines in picture including the server would have a time close to each other.


      I hope, my question is clear.


      Please revert with the reply to my query.