Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am having an issue with the time on a production linux server being 2 hours fast. I need the time to be accurate for a particular project I'm working on, but am a little nervous to change it, as I'm not sure the ramifications of this.

From my research it appears that the best way to change it would be the command:

ntpd -q

Is that correct?

This is a Fedora 7 (yes we are upgrading soon) web server with apache and php on it. Would there be any side effects for syncing up the clock to the correct time?

share|improve this question

4 Answers 4

up vote 3 down vote accepted

The best solution is to configure and run ntpd in daemon mode. Provided your clock is not too far off the time server, 1000 seconds by default, then your clock will slowly be adjusted. This prevents large jumps in your clock. Of course, since your clock is more than 1000 seconds off, you will have to manually set your clock the first time.

To install, set the clock, and run ntpd you can issue the following commands:

yum install ntp
chkconfig --levels 235 ntpd on
ntpdate 0.pool.ntp.org
/etc/init.d/ntpd start
share|improve this answer

If you do sync with a ntp server regularly (ie every day), you won't have any problem. Time shift will be too small to be noticed.

You may have problem at the first sync: apache logs will contain some "duplicate" entries. There will be the ones from "old hour" and the ones from "new hour" so yous statistics won't be accurate for this timeframe.

share|improve this answer

Is it exactly two hours fast? Maybe you just have the wrong timezone configured on the machine. Check out "tzconfig".

share|improve this answer

I'd recommend setting the clock in single-user mode. Moving clocks backwards can break various application, particularly server application software which tends to assume that clocks will (mostly) only run forwards.

At the very least, consider shutting down your major app servers on the box before adjusting the clock.

If you are being really cautious, don't start the app servers up again until the previous "time" has been reached.

I develop server software, and we normally assume that clocks will not run backwards much; clocks running backwards makes certain things really difficult to get right (such as assigning unique IDs, knowing how long things have been in queues).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.