NTP sync issue on client servers

1

Does starting up NTPD daemon will automatically sync the client server with NTP server?

Our server is running 5 mins behind the current time when we checked the service was in stopped state so does just bringing up the service with perform the sync and correct the time drift or I need to manually run:

ntpdate -u <ntp server>

biz

Posted 2016-02-08T20:01:08.713

Reputation: 29

Answers

0

This completely depends on the version of Linux you are using, but in general NTP syncing should be transparent and seamless; you should not have to manually kick off anything to get it running. That said, on older Ubuntu installs I did the following to force the system to rsync on a regular basis

First, create the following file in the cron daemon queue; I’m using Nano as an editor but feel free to use whatever plain text editor you prefer to us:

sudo nano /etc/cron.daily/ntpdate

And add this command to that file:

ntpdate -s -u ntp.ubuntu.com

Save and close that file and then make sure it has proper execute permissions like so:

sudo chmod 755 /etc/cron.daily/ntpdate

With that done, that ntupdate command will run daily behind the scenes without any additional user intervention.

JakeGould

Posted 2016-02-08T20:01:08.713

Reputation: 38 217

Is it safe to run ntpdate on a vm's which is holding SAP Application or Database ? I have seen many instance where correcting the time results in crashing the SAP instances.. – biz – 2016-02-08T20:18:38.493

@biz As you are behind the current time the application should be good. VMs should have their time synchronized to the containing server. Different containers have different mechanisms. This is where I would run ntpd. The current NTP servers can be configured to slew time if you want to correct time slowly. – BillThor – 2016-02-09T00:49:13.460

@BillThor So irrespective of behind/forward time is it safe to run ntpdate directly without bringing down the app/DB?Most of my servers are on OL5.5-6.x. Also can i configure a cronjob to run this on daily basis with slew argument? – biz – 2016-02-09T08:13:12.713

@biz ntpd is a deamon and should not need to be restarted. It is likely shutting down because your offset is outside the safe margins. Check http://serverfault.com/questions/671412/risk-of-starting-ntp-on-database-server/671489#671489 for some more details.

– BillThor – 2016-02-10T00:32:26.660

Don't do it! ntpdate will jump the time - you don't want that with a production system. Configure/fix ntp and get that to slew the clock till its correct. That way you avoid any nasty jumps which might break something. – user3788685 – 2016-02-11T23:24:49.407