Friday, 5 October 2012

Setting the time and date in CENTOS

Sometimes, you may get the following error while trying to sync your Ubuntu server time with the NTP server using "ntpdate" command:

============
~# sudo ntpdate pool.ntp.org
5 Dec 01:32:33 ntpdate[21647]: the NTP socket is in use, exiting
============


The ntpdate command will not run when the NTP server is running. If you run ntpdate and get a response like "the NTP socket is in use", that means your NTP server is running. Stop it with the command:

===
sudo /etc/init.d/ntp stop
===

You can now run ntpdate with the server you want to sync against as an argument. For example, to tell ntpdate to try and sync with "pool.ntp.org", run:

===
sudo ntpdate pool.ntp.org
===

When you're finished testing remember to start NTP back up again:

===
sudo /etc/init.d/ntp start
===

No comments:

Post a Comment