Wednesday, September 08, 2004

Sychronize Redhat Linux time to the internet

This article.
Says:

Hi everyone,

These are my steps that I have been doing to get my Red Hat Linux system clock updated in the crontab with one of the time server using rdate.

What is rdate?

man rdate to read more
rdate connects to an RFC 868 time server over a TCP/IP network, printing the returned time and/or setting the system clock using port 37.

You can check out the time servers used by the NIST Internet Time Service (ITS) at:
http://www.boulder.nist.gov/timefre...me-servers.html
I will be using time.nist.gov time server as an example in this thread and you are free to use any time server you preferred

If you have firewall installed, please set to allow port 37 TCP connection.

Step 1: login to your server via SSH and gain root access.

Step 2: check whether rdate is installed:

code:
rpm -qa | grep rdate

If it is not install, kindly please install rdate before continue.

Step 3: add the following in your /etc/crontab file:
code:
# synchronize system time on every 6AM daily with time server
00 6 * * * root rdate -s time.nist.gov


You can do this by cut and paste the following command:
code:
cat >> /etc/crontab << "EOF"
# synchronize system time on every 6AM daily with time server
00 6 * * * root rdate -s time.nist.gov && /sbin/hwclock --systohc
EOF



If you want to update your system & hardware time now, issue the following command in SSH:
code:
rdate -s time.nist.gov

/sbin/hwclock --systohc