UnixServerAdmin

Server Administration & Management

How to fix the time drift issue on a cPanel linux server

Many times you may notice a time drift problem on the server. It is common with some of the AMD Processor server series as well.  In most cases its impact is not very high and it can be controlled by setting up a cron to run each minute to make sure the time remains close to accurate.

e.g. you can setup below cron in either root cron file at /var/spool/cron or in /etc/crontb

*/1 * * * * rdate -s rdate.cpanel.net

This basically syncs the time using rdate, you can use cPanel’s rdate server or any of other public rdate servers.

Another way to fix it is by setting up ntpd (Network Time Protocol Daemon) on the server and is a method to achieve more accurate results. You can install ntp using following simple commands :

# yum install ntp

Edit /etc/ntp.conf for choice of your server

# vi /etc/ntp.conf

The default timer servers should work too , or you can update them as per your liking. The service can be controlled using below simple/standard commands :

# service ntpd start

# service ntpd stop

# service ntpd restart

There are more detail configuration settings as well like drift etc, but for normal use the default settings should be fine.  Another reason for time drift ( usually a crazy one ) can be kernel specific problem. That is in this case the time drifts forward and background with a jump of 20 / 30 seconds, and this becomes a serious problem resulting in failure of different services, one server I handled had both imap and ftp services failing on it.
This was a cPanel server with courier throwing below error :

BYE Clock skew detected. Check the clock on the file server

And ftp was also failing with such a time drift as was not able to do the initial connection session. This was resolved by installing the latest CentOS5 kernel on the related sever.

So for resolving a time drift issue, your sequence would be from rdate cron, ntpd to kernel upgrade , depending on what exactly is the problem and how severe it is.

If you have to choose between cron and ntpd then ntpd solution is preferred.

December 10, 2011 Posted by | cPanel, NTP | , , | 1 Comment