Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Might be that your server is running a wrongly configured ntp daemon.
NTP (network time protocol) syncs your machine's clock with that of an NTP servers and is
mainly used to establish the same time on a bunch of machines.
Maybe your timezone isn't correctly set up. If the difference is exactly 7 hours.
Try looking in /etc/ntp.conf
The NTP daemon uses some files in /etc/ntp/ too. But those aren't config files.
The comments in ntp.conf should explain what you need.
More specifically, look especially at the "server ..." lines.
There are global NTP servers around that you can query. But, in order to be polite to everybody
else on the planet who are also using them, you should restrict your queries to them, for instance to
one machine. This machine can then become your local NTP server for all your other machines (which is of course faster than querying the global machines).
Indeed. NTP just synchronizes your system's internal clock (rtc - real time clock) to the clock
on an NTP server.
How you display this clock is up to you, I suppose. But this is what I meant by "setting up the timezone".
RedHat/Fedora provide a graphical interface for setting the system date/time. I suppose other Linux distros will do the same. In this "date/time properties" window, you can also configure your system to use NTP and choose an appropriate timezone.
On my RedHat box, I can access this interface by clicking with the right mouse button on the displayed date/time on the desktop and choosing "Adjust Date & Time" from the menu that appears.
My point is, if you have NTP daemon running, the clock will correct itself after a little while, no matter what it has done at reboot.
If I understand correctly, your clock changes automatically at reboot (which is normal, I suppose).
It's supposed to re-align itself to your hardware clock, called the real time clock (rtc).
NTP interferes only after the launch of the ntp daemon (ntp service) during the boot sequence.
It should however update not only your system clock, but also the hardware clock.
Can you also please clarify your problem a little? My English isn't so great.
More precisely, what do you mean with "in advance 7 hours"? Does it jump to 7 hours more (or less) than the real time? Or does it change 7 hours after the reboot?
To check if the ntp daemon, called ntpd is running, you can try either:
ps -efl | grep -i ntpd
/sbin/service ntpd status
/sbin/chkconfig --list |grep ntpd #check if it's "on" for your runlevel (probably either 3 or 5).
My next question. Where does it display "17:xx:x"? What does "date" say? and "hwclock"?
Is the time that's displayed for the right timezone? Your /etc/sysconfig/clock file seems to be OK.
As you can clearly see, your ntp daemon isn't running (no ntpd process in the "ps" output and "ntpd
is stopped" message from "service" program. chkconfig --list shows that ntpd will also not be restarted
at each reboot (or runlevel change), but it should.
To start ntpd, follow the following steps:
*Check the ntp config
*If the config is OK, type (as root):
/sbin/service ntpd start
/sbin/chkconfig --level 345 ntpd on
The first one will start "ntpd" directly.
The second command (chkconfig) will make ntpd run at runlevels 3, 4 and 5 (ie when reboot is successful).
When ntpd is running, it will adjust your clock, but it may take a while before the clock shows the right time.
You can also change the hardware clock manually, instead of using ntpd.
But your hardware clock can run slightly too fast or too slow, which implies that you need to adjust it
in the future (ie after a few years) or that you need to live with the fact that your clock is slightly off.
Changing the hardware clock can be done with the methods described above (changing your Linux clock should alter the hardware clock too) or from the BIOS.
I don't know the actual mechanism behind the NTP system, but you don't need to know it. The important fact is that with NTP, you have assurance that your clock is (as good as) correct.
But, it seems likely that somewhere, there is an atomic clock that defines (standardizes) the clock for everybody. This clock may be propagated via satellite to a few global NTP servers, that you can query to get the right clock.