1

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?

4 Answers 4

3

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
1

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.

1

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

1

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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .