Friday, July 10, 2009

Clock setting in Linux

In almost all applications time being in sync is very important. Even simple logging needs accurate time to keep the logs in tune.

Servers have a hardware clock and an OS software clock and both need to be in sync as well as in sync with a certified time source.

If you already use NTP to keep your software clock in sync with a certified time source it is pretty easy to keep your hardware clock up to date with the OS time.

Here are some basic commands:

To set the syste/OSm clock from the hardware clock:
#> sudo hwclock --hctosys

Likewise if your hardware clock is set incorrectly (for example, if you replaced the
CMOS battery on your motherboard), you can set the hardware clock from your system clock as follows:

Likewise, set the hardware clock from the software/OS clock:

#> hwclock --systohc

As always, there are a lot more options available so check out the man pages.

No comments:

Post a Comment