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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
03-25-2010, 07:25 AM
|
#1
|
|
Member
Registered: Dec 2008
Posts: 41
Rep:
|
How can I permanently fix my clock synchronization problem?
Ubuntu 7.10 server i386 clock/date/time won't stay in sync. Are their log files I can view to tell when the clock changes? For a temporary fix, I created a file in /etc/cron.hourly:
#!/bin/sh
ntpdate time.nist.gov
However, this still leaves a potential hour of unchecked time. Is there a cron.minutely? That would still leave a potential minute of unchecked time. I have read about CMOS battery problems, but what if this does not fix it? I'd like to be able to troubleshoot this as a completely software problem.
My squid logs are showing dates back in 2005 when the clock changes, and my time-sensitive access controls are skewed and end up allowing users to surf prohibited websites during business hours.
Thanks in advance!
|
|
|
|
03-25-2010, 07:39 AM
|
#2
|
|
Member
Registered: Feb 2009
Distribution: CentOS 5, Gentoo, FreeBSD, Fedora, Mint, Slackware64
Posts: 205
Rep:
|
Try running an ntp server. It will keep your own clocked sync'd and you can set it to not serve any other computers. It can account for drift rates in your system clock by adjusting it's own update times and driftrate calculations. Also, the newer versions are fairly easy to configure.
|
|
|
|
03-25-2010, 07:41 AM
|
#3
|
|
Member
Registered: Dec 2008
Posts: 41
Original Poster
Rep:
|
that sounds like a good idea. ill read up and let you know
|
|
|
|
03-25-2010, 07:46 AM
|
#4
|
|
Member
Registered: Feb 2009
Distribution: CentOS 5, Gentoo, FreeBSD, Fedora, Mint, Slackware64
Posts: 205
Rep:
|
Something I did forget to mention. If it's on a server which reboots often and may loose time in the time it's off, you can use ntpdate on boot to do the initial sync before starting the ntpd. This is a good idea since ntpd doesn't like to sync up if the time is too different from what it should be.
I do this on my home servers.
|
|
|
|
03-25-2010, 07:48 AM
|
#5
|
|
Member
Registered: Dec 2008
Posts: 41
Original Poster
Rep:
|
this server is only reboot under extreme troubleshooting circumstances. thats why i was hoping to avoid the cmos battery since that has to be done when powered off, correct?
how can i run commands on boot?
|
|
|
|
03-25-2010, 07:50 AM
|
#6
|
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian Squeeze (server), Slackware 13.37 (netbook), Slackware64 14.0 (desktop),
Posts: 8,358
|
Quote:
Originally Posted by gr33d
I have read about CMOS battery problems, but what if this does not fix it?
|
The CMOS battery is only used to keep the clock going when the system is powered down. While the system is running Linux keeps its own time (presumably in a hardware device). Boot and shutdown messages confirm this when they say something like "Setting time from hardware clock" and "Saving time to hardware clock"
If your time is changing while the system is running (more than a slight drift) then you either have a hardware problem or something is changing it.
|
|
|
|
03-25-2010, 07:53 AM
|
#7
|
|
Member
Registered: Jan 2009
Location: Mumbai, India
Distribution: Fedora 9, 10,11, RHEL 5
Posts: 67
Rep:
|
Quote:
Originally Posted by gr33d
how can i run commands on boot?
|
You have to modify the system initializing scripts. To run ntpdate before running the ntpd. Change the file (/etc/init.d/ntpd probably) to include a line to run ntpdate just before ntpd is acutally run.
|
|
|
|
03-25-2010, 07:55 AM
|
#8
|
|
Member
Registered: Feb 2009
Distribution: CentOS 5, Gentoo, FreeBSD, Fedora, Mint, Slackware64
Posts: 205
Rep:
|
Quote:
|
how can i run commands on boot?
|
This depends on the system that you run. There are a few different ways to run commands on boot. On redhat based systems, you could add a script into the /etc/rc.d/init.d/scripts and then call it from the various runtime directories. Gentoo is different from that. Ubuntu, I don't know, but that question can probably be easily searched from google or on the boards here.
|
|
|
|
03-25-2010, 07:58 AM
|
#9
|
|
Member
Registered: Jan 2009
Location: Mumbai, India
Distribution: Fedora 9, 10,11, RHEL 5
Posts: 67
Rep:
|
Ubuntu uses Upstream startup scripts which are slightly different from the Sys V Init Scripts.
|
|
|
|
03-25-2010, 08:14 AM
|
#10
|
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian Squeeze (server), Slackware 13.37 (netbook), Slackware64 14.0 (desktop),
Posts: 8,358
|
Quote:
Originally Posted by nuwen52
Ubuntu, I don't know, but that question can probably be easily searched from google or on the boards here.
|
On ubuntu 8.04 I had to install the ntp package (done via Synaptic) then used System->Admin->"Time + Date" to set time zone and enter time server names. Time server names are best chosen from the country lists at http://www.pool.ntp.org/en/use.html (or continent if you live in a country with inadequate time servers).
This didn't seem to work, though; inspecting /etc/ntp.conf showed ntp.ubuntu.com had gone but the new ones had not appeared.
After adding the missing servers manually to the end of /etc/ntp.conf like this
Code:
server in.pool.ntp.org
server asia.pool.ntp.org
and rebooting (not the fastest way but works and is easy) /var/log/daemon.log showed ntpdate and ntpd activity. It can take several minutes for ntpd to synchronise -- hey, it's got the time!
AFAIK NTP is started by the /etc/init.d/networking script and you don't need to do anything after installing and configuring it to have it stated at boot.
|
|
|
|
03-25-2010, 08:17 AM
|
#11
|
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian Squeeze (server), Slackware 13.37 (netbook), Slackware64 14.0 (desktop),
Posts: 8,358
|
Quote:
Originally Posted by sreeharsha.t
Ubuntu uses Upstream startup scripts which are slightly different from the Sys V Init Scripts.
|
Do you mean Upstart? The SysVinit mechanism was still in use, parallel to the few bits of Upstart in 8.04; I imagine there was less Upstart in 7.10.
|
|
|
|
03-29-2010, 02:06 PM
|
#12
|
|
Member
Registered: Dec 2008
Posts: 41
Original Poster
Rep:
|
the ntp server seems to be doing the trick. thanks for your help!
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 01:57 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|