LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 10-26-2009, 11:05 PM   #1
tdnguyenitvn
LQ Newbie
 
Registered: Jan 2009
Posts: 10

Rep: Reputation: 0
Question synchonize time in centos (urgent)


Dear All,

I'm using VPS with OS CentOS to hosting website, but the time can not synchronize with my time zone.

Who can help me?

Thank you.

Last edited by tdnguyenitvn; 10-26-2009 at 11:12 PM.
 
Old 10-26-2009, 11:09 PM   #2
foodown
Member
 
Registered: Jun 2009
Location: Texas
Distribution: Slackware
Posts: 611

Rep: Reputation: 220Reputation: 220Reputation: 220
http://www.wikihow.com/Change-the-Timezone-in-Linux

Then, you can keep time current with ntp with a command like:
Code:
ntpdate pool.ntp.org
 
Old 10-27-2009, 12:09 AM   #3
tdnguyenitvn
LQ Newbie
 
Registered: Jan 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Question

Quote:
Originally Posted by foodown View Post
http://www.wikihow.com/Change-the-Timezone-in-Linux

Then, you can keep time current with ntp with a command like:
Code:
ntpdate pool.ntp.org
I do that before, but it's still can not.

How can i do with crontab to schedule synchronize about 5 minutes?

thank you
 
Old 10-27-2009, 12:27 AM   #4
foodown
Member
 
Registered: Jun 2009
Location: Texas
Distribution: Slackware
Posts: 611

Rep: Reputation: 220Reputation: 220Reputation: 220
As root, do a 'crontab -e'

Then add this line:
Code:
*/5 * * * * /usr/sbin/ntpdate pool.ntp.org 1> /dev/null 2> /dev/null
Save and quit with a ':wq'

Did you follow the link that I posted?
 
Old 10-27-2009, 12:54 AM   #5
tdnguyenitvn
LQ Newbie
 
Registered: Jan 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by foodown View Post
As root, do a 'crontab -e'

Then add this line:
Code:
*/5 * * * * /usr/sbin/ntpdate pool.ntp.org 1> /dev/null 2> /dev/null
Save and quit with a ':wq'

Did you follow the link that I posted?
I follow already but it can not synchronize.

Thank you, i will add this schedule to the crontab.
 
Old 10-27-2009, 01:01 AM   #6
foodown
Member
 
Registered: Jun 2009
Location: Texas
Distribution: Slackware
Posts: 611

Rep: Reputation: 220Reputation: 220Reputation: 220
What makes you say that it cannot synchronize . . . what are you seeing that indicates this to you?
 
Old 10-27-2009, 01:45 AM   #7
tdnguyenitvn
LQ Newbie
 
Registered: Jan 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by foodown View Post
What makes you say that it cannot synchronize . . . what are you seeing that indicates this to you?
The time on my server always run fast than real time.

When i use with your crontab but it still can not run correct.
 
Old 10-27-2009, 02:10 AM   #8
foodown
Member
 
Registered: Jun 2009
Location: Texas
Distribution: Slackware
Posts: 611

Rep: Reputation: 220Reputation: 220Reputation: 220
So, first off, what timezone are you in?
Please post the output of:
Code:
ls -l /etc/localtime
ls -Rl /usr/share/zoneinfo
ntpdate pool.ntp.org
date
ntpdate pool.ntp.org
date
 
Old 10-27-2009, 02:34 AM   #9
tdnguyenitvn
LQ Newbie
 
Registered: Jan 2009
Posts: 10

Original Poster
Rep: Reputation: 0
ls -l /etc/localtime

lrwxrwxrwx 1 root root 31 Oct 27 10:22 /etc/localtime -> /usr/share/zoneinfo/Asia/Saigon

ntpdate pool.ntp.org
27 Oct 13:33:03 ntpdate[2645]: step time server 221.132.37.28 offset -344.029524 sec

date
Tue Oct 27 13:33:55 ICT 2009
 
Old 10-27-2009, 03:05 AM   #10
foodown
Member
 
Registered: Jun 2009
Location: Texas
Distribution: Slackware
Posts: 611

Rep: Reputation: 220Reputation: 220Reputation: 220
How long does it take to get fast?

I mean, if you run two ntpdate calls back to back, is there a significant offset on the second run?
 
Old 10-27-2009, 03:37 AM   #11
tdnguyenitvn
LQ Newbie
 
Registered: Jan 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by foodown View Post
How long does it take to get fast?

I mean, if you run two ntpdate calls back to back, is there a significant offset on the second run?
about 2 seconds. after 5 minutes it will run fast than with real time about 1 minute.
 
  


Reply

Tags
centos, time


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
First Time Trying to Get CentOS 5 to Connect Wirelessly Ascendancy5 Linux - Wireless Networking 4 06-16-2012 03:41 PM
Centos 4.0 to 4.2 Download Sites PLEASE HELP URGENT simfukwe Linux - Distributions 2 12-02-2005 01:45 PM
Mandrake 9.1: Hard time installing w/ 9500 Pro - Urgent. RobG Linux - Hardware 4 07-30-2003 03:03 PM
Mandrake 9.1: Hard time installing w/ 9500 Pro - Urgent. RobG Linux - General 1 07-28-2003 11:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 03:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration