LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 01-05-2006, 04:52 AM   #1
yytan
LQ Newbie
 
Registered: Jan 2006
Posts: 6

Rep: Reputation: 0
Linux time change after reboot


hi;

i'm using linux 7.2. recently, i've no idea why the server date time will always auto change in advance 7 hours after i've reboot the machine.

appreciate for help, tq.

Last edited by yytan; 01-05-2006 at 05:11 AM.
 
Old 01-05-2006, 05:12 AM   #2
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
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.
 
Old 01-05-2006, 05:56 AM   #3
yytan
LQ Newbie
 
Registered: Jan 2006
Posts: 6

Original Poster
Rep: Reputation: 0
can u tell me where to configure or check NTP ?

my timezone = singapore, have set correctly.
 
Old 01-05-2006, 07:48 AM   #4
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
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).
 
Old 01-05-2006, 08:52 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
What is "Linux 7.2" You mean RedHat? SUSE?

You should have an option as to how to set the hardware clock. The Unix default is to set it to UTC (GMT)

I think NTP should work regardless of how you tell your clock to display????
 
Old 01-05-2006, 09:09 AM   #6
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
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.

Last edited by timmeke; 01-05-2006 at 09:10 AM.
 
Old 01-06-2006, 06:08 AM   #7
yytan
LQ Newbie
 
Registered: Jan 2006
Posts: 6

Original Poster
Rep: Reputation: 0
hi;
i'm using redhat 7.2

i've checked cmd with ,
$ date
$ hwclock -u
all return correct time & zone. duno wher has gone wrong.

again, my question is, how to fix my prob " server date time will always auto change in advance 7 hours after i've reboot the machine. "

really appreciate if some one can point me guides.
 
Old 01-06-2006, 06:18 AM   #8
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
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?
 
Old 01-06-2006, 06:23 AM   #9
yytan
LQ Newbie
 
Registered: Jan 2006
Posts: 6

Original Poster
Rep: Reputation: 0
timmeke;

thanks for your response.

1) how to check NTP daemon whether is runing?

2) let say now is 10:00:00 (10am), i restart my server, then when it comes to login, it display the time as 17:xx:xx (5pm)

for your information:
- $date & hwclock return same time now
- $cat /etc/sysconfig/clock
ZONE = ASIA/ SINGAPORE
UTC = false
ARC = false

Hope to hear from you soon.
 
Old 01-06-2006, 06:24 AM   #10
amosf
Senior Member
 
Registered: Jun 2004
Location: Australia
Distribution: Mandriva/Slack - KDE
Posts: 1,672

Rep: Reputation: 46
Wow Rad Hat 7.2... That takes me back a few years...
 
Old 01-06-2006, 07:24 AM   #11
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
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.
 
Old 01-06-2006, 07:37 AM   #12
yytan
LQ Newbie
 
Registered: Jan 2006
Posts: 6

Original Poster
Rep: Reputation: 0
this is the result:

[!] /opt/jakarta-tomcat-4.1.24/logs>ps -efl | grep -i ntpd
0 S root 7747 11372 0 75 0 - 924 pipe_w 21:23 pts/2 00:00:00 grep -i ntpd

[!] /sbin>service ntpd status
ntpd is stopped
[!] /sbin>
[!] /sbin>chkconfig --list |grep ntpd
ntpd 0ff 1ff 2ff 3ff 4ff 5ff 6ff
[!] /sbin>


Yes, date & hwclock display as 17:xx:xx hr, (5pm)
17:xx:xx display on the bottom right corner, time properties, with correct time zone.
 
Old 01-06-2006, 08:24 AM   #13
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
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.
 
Old 01-08-2006, 11:54 PM   #14
yytan
LQ Newbie
 
Registered: Jan 2006
Posts: 6

Original Poster
Rep: Reputation: 0
Hi;

can u tell me, why do i need to start ntpd? i've another server which not started ntpd process, but when i do server reboot, the time display alright.

i've read ntpd will syn the hwclock thru satellite?
 
Old 01-09-2006, 02:06 AM   #15
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
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.
 
  


Reply



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
Change Time automatically in linux juanb Linux - Software 5 09-24-2005 06:20 AM
linux time changes 1 hour -- after reboot mrconover Linux - Software 4 10-07-2004 05:13 PM
i ajdust my alsa mixer and every time i reboot my pc the mixer change what to do ? SlackwareMan Linux - Newbie 1 07-30-2004 01:39 AM
How to change time slice of linux? zhu_liheng Programming 1 12-19-2003 03:52 AM
how to change the time on Linux ashley75 Linux - General 2 10-08-2003 03:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:30 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
Open Source Consulting | Domain Registration