Wednesday, July 3, 2013

NTP error - ntpd dead but pid file exists

[root@server1~]# ntpq -np
ntpq: read: Connection refused

[root@server1 ~]# /etc/init.d/ntpd status
ntpd dead but pid file exists

[root@server1~]# cat /etc/sysconfig/ntpd
# Drop root to id 'ntp:ntp' by default.
OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid"

# Set to 'yes' to sync hw clock after successful ntpdate
SYNC_HWCLOCK=no

# Additional options for ntpdate
NTPDATE_OPTIONS=""

Edit the configuration file and change the contents like below
[root@server1 ~]# vi /etc/sysconfig/ntpd

[root@server1~]# cat /etc/sysconfig/ntpd
# Drop root to id 'ntp:ntp' by default.
#OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid"

# Set to 'yes' to sync hw clock after successful ntpdate
SYNC_HWCLOCK=no

# Additional options for ntpdate
NTPDATE_OPTIONS=""

etc/init.d/ntpd restart
Shutting down ntpd:                                        [FAILED]
Starting ntpd:                                             [  OK  ]
[root@server1 ~]# /etc/init.d/ntpd restart
Shutting down ntpd:                                        [  OK  ]
Starting ntpd:          

[root@server1~]# ntpdate -u pool.ntp.org
13 Jun 09:16:22 ntpdate[24783]: adjust time server 69.167.160.102 offset -0.064985 sec

[root@server1 ~]# /etc/init.d/ntpd restart
Shutting down ntpd:                                        [  OK  ]
Starting ntpd:                                             [  OK  ]
[root@server1 ~]# ntpq -np
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 72.14.183.239   216.218.254.202  2 u    3   64    1    0.001  -38.576   0.001
 72.14.183.39    164.244.221.197  2 u    2   64    1    0.001  -37.146   0.001
 65.49.70.244    127.67.113.92    2 u    1   64    1    0.001    2.791   0.001
 127.127.1.0     .LOCL.          10 l    -   64    1    0.000    0.000   0.001

No comments: