SBDavid
Nov 13th, 2011
Nov 13th, 2011
Using ntpdate command
Using ntpdate command
The ntpdate command will sync your clock with an NTP server
The ntpdate command will not run when the NTP server is running, if you run then it says the NTP socket is in use, exiting.
[centos@centos ~]$ grep ^server /etc/ntp.conf
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org
[centos@centos ~]$ sudo ntpdate 0.rhel.pool.ntp.org
[sudo] password for centos:
13 Nov 19:15:42 ntpdate[10611]: the NTP socket is in use, exiting
[centos@centos ~]$
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org
[centos@centos ~]$ sudo ntpdate 0.rhel.pool.ntp.org
[sudo] password for centos:
13 Nov 19:15:42 ntpdate[10611]: the NTP socket is in use, exiting
[centos@centos ~]$
Stop NTP and then run ntpdate
centos@centos ~]$ sudo /etc/init.d/ntpd stop
Shutting down ntpd: [ OK ]
[centos@centos ~]$ sudo ntpdate 0.rhel.pool.ntp.org
13 Nov 19:16:58 ntpdate[10636]: adjust time server 123.108.200.163 offset -0.285447 sec
[centos@centos ~]$ sudo /etc/init.d/ntpd start
Starting ntpd: [ OK ]
[centos@centos ~]$ pgrep ntp
10643
[centos@centos ~]$
Shutting down ntpd: [ OK ]
[centos@centos ~]$ sudo ntpdate 0.rhel.pool.ntp.org
13 Nov 19:16:58 ntpdate[10636]: adjust time server 123.108.200.163 offset -0.285447 sec
[centos@centos ~]$ sudo /etc/init.d/ntpd start
Starting ntpd: [ OK ]
[centos@centos ~]$ pgrep ntp
10643
[centos@centos ~]$
Reference: http://support.ntp.org/bin/view/Support/GettingStarted