hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : Hosting Security and Technology Tutorials : Synchronize Your Red Hat Linux Server/System Clock/Time using rdate
Reply

Hosting Security and Technology Tutorials Tutorials related to server security or the like.
Forum Jump

Synchronize Your Red Hat Linux Server/System Clock/Time using rdate

Reply Post New Thread In Hosting Security and Technology Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 02-01-2004, 04:41 PM
choon choon is offline
Retired Moderator
 
Join Date: Jul 2001
Location: Singapore
Posts: 1,790

Synchronize Your Red Hat Linux Server/System Clock/Time using rdate


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/timefreq...e-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
Hope this helps

Thanks.

Kindest regards,
Choon


Last edited by choon; 02-01-2004 at 04:48 PM.
Reply With Quote


Sponsored Links
  #2  
Old 02-01-2004, 04:47 PM
choon choon is offline
Retired Moderator
 
Join Date: Jul 2001
Location: Singapore
Posts: 1,790
This is another way of doing it but you can't specify when to synchronize your server/system clock/time though

Step 1: Gain root access via SSH to your server.

Step 2: Check whether rdate is installed.
Code:
rpm -qa | grep rdate
If rdate is not install, please install it before continue.

Step 3: Create a shell script, chmod it to executable and place it into /etc/cron.daily directory with the below content.
Code:
#!/bin/sh
rdate -s time.nist.gov
/sbin/hwclock --systohc
For me, I create /etc/cron.daily/rdate file directly using the following command:
Code:
cat > /etc/cron.daily/rdate << "EOF"
#!/bin/sh
rdate -s time.nist.gov
/sbin/hwclock --systohc
EOF

chmod +x /etc/cron.daily/rdate
Hope this helps

Thanks.

Kindest regards,
Choon

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Web Host Earthnet Launches Xpert.net Linux Web Hosting Services Web Hosting News 2012-03-23 16:09:07
Linux OS CloudLinux Releases Virtualized File System for Shared Web Hosts Web Hosting News 2012-02-16 14:22:51
Web Host 1&1 Enhances Dedicated Server Line with 32 Core, 64 GB RAM Server Web Hosting News 2011-12-20 15:30:05
Web Hosting Software Firm CloudLinux Releases CloudLinux OS Version 6.1 Web Hosting News 2011-09-13 14:08:49
Web Host ServerBeach Now Offers Virtual Servers Web Hosting News 2011-08-02 18:44:09


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?