FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 02-04-2009, 12:56 PM
Dale
 
Default /etc/init.d/: ntpd or ntp-client?

Stroller wrote:
> Hi there,
>
> I just logged into one of my machines that has recently been powered
> down for a few days - not a terribly common occurrence with my servers
> - to find a date of January 30th showing.
>
> I used to run ntp-client, but AIUI adding this to the default runlevel
> only sets the clock once at boot up. Of course the problem with that
> is that the computer's clock can become inaccurate if the spring
> tension is weak, as is obviously the case in my older PCs.
>
> So a while back I changed /etc/runlevels/default so that ntpd is
> started instead.
>
> I understood that ntpd was not only a server for my LAN (a facility I
> don't use) but that it would also periodically check the time with
> upstream servers & keep the machine's clock in constant sync.
>
> So when I found the clock to be a week out of date I checked that ntpd
> appeared to be running (it was) and restarted it. The date remained
> the same. Stopping ntpd & starting ntp-client corrected the date
> immediately.
>
> Before I do any investigation, can someone tell me if my understanding
> so far is correct? Is ntpd supposed to keep the machine's clock in
> constant sync, or is it only (say) a server to offer the date to
> clients? (depending upon the clock being set correctly by other means)
> I thought I had configured ntpd with upstream servers separately from
> ntp-client.
>
> Stroller.
>
>

I use ntpd here as well. Ntpd does not set it immediately like other
commands do. From my understanding ntpd compares its time to a server
then gradually adjusts the clock by speeding up or slowing down the
clock. It takes a while to do this. If your clock is a long ways off
then it will take longer.

I'm not sure if this is still true but I read that if it is way off,
several days or longer I would assume, it will require you to adjust it
manually or you could set it with ntpdate which will set it instantly
from one of the time servers. In this case, set the clock then restart
ntpd.

Hope that helps.

Dale

:-) :-)
 
Old 02-04-2009, 12:57 PM
Alan McKinnon
 
Default /etc/init.d/: ntpd or ntp-client?

On Wednesday 04 February 2009 15:38:11 Stroller wrote:
> Before I do any investigation, can someone tell me if my understanding *
> so far is correct? Is ntpd supposed to keep the machine's clock in *
> constant sync, or is it only (say) a server to offer the date to *
> clients? (depending upon the clock being set correctly by other means) *
> I thought I had configured ntpd with upstream servers separately from *
> ntp-client.

ntp is one of those things that looks really easy and turns out to be
horrendously complicated once you scratch the surface. The problem is not ntp
itself, it's the subject of time.

ntp is indeed both a server for it's host machine and your LAN, but also a
client to upstream. It is also full of precautions:

It will not make your clock jump forwards or backwards if your time is way
out. ntp keeps track of how weak your clock spring is and gradually pulls the
local clock back into sync with the master clock by making the length of
seconds fractionally shorter or longer. It does this so that there are no
gaps in the time record. If it suddenly pulled the clock forward, the time
tick for midnight might never happen and your crons might not run. I forget
what the threshold is, but it's not long; and it can take several hours to
correct a clock that is only a few minutes out.

ntpd is really designed for Unix servers with 3 digit uptimes and clocks not
assembled by Mickey Mouse's younger brother (which seems to include all pcs
ever made.....)

Most folk are better off with ntpdate run from a cron. When run, it checks the
upstream time and immediately corrects the local clock to that time. Schedule
it for once an hour or so, depending on your bandwidth and local ntp site's
policies.

--
alan dot mckinnon at gmail dot com
 
Old 02-04-2009, 01:11 PM
Neil Bothwick
 
Default /etc/init.d/: ntpd or ntp-client?

On Wed, 4 Feb 2009 13:38:11 +0000, Stroller wrote:

> So when I found the clock to be a week out of date I checked that ntpd
> appeared to be running (it was) and restarted it. The date remained
> the same. Stopping ntpd & starting ntp-client corrected the date
> immediately.

ntpd will not change the time if the difference is too large, the man
page gives the limit. You need to run both at boot; ntp-client sets the
time immediately, no matter what the skew, then ntpd keeps the clock in
time.

--
Neil Bothwick

Nymphomania-- an illness you hear about but never encounter.
 
Old 02-04-2009, 05:12 PM
Dirk Heinrichs
 
Default /etc/init.d/: ntpd or ntp-client?

Am Mittwoch, 4. Februar 2009 14:57:28 schrieb Alan McKinnon:

> ntpd is really designed for Unix servers with 3 digit uptimes and clocks
> not assembled by Mickey Mouse's younger brother (which seems to include all
> pcs ever made.....)

Errh, no. It is designed for exactly those machines, so that they are
independant of their hardware (Mickey Mouse) clock and of course to keep them
all in sync with each other (and the Unix servers they connect to).

> Most folk are better off with ntpdate run from a cron. When run, it checks
> the upstream time and immediately corrects the local clock to that time.
> Schedule it for once an hour or so, depending on your bandwidth and local
> ntp site's policies.

That does exactly what NTP tries to avoid: Time jumps.

So when you're not connected to the net permanently, one has two choices:

1) Choose one of your machines as the ntp time server which delivers the time
of its internal clock and synchronize each others time with this one. In the
end it only matters that the time is correct in _your_ own network, isn't it.

2) If even the most accurate internal clock on your network is not accurate
enough, plug an accurate time source into one machine you choose as time
server, then goto 1).

Bye...

Dirk
 
Old 02-04-2009, 05:17 PM
Stroller
 
Default /etc/init.d/: ntpd or ntp-client?

On 4 Feb 2009, at 13:40, Justin wrote:

Stroller schrieb:

...
I understood that ntpd was not only a server for my LAN (a facility I
don't use) but that it would also periodically check the time with
upstream servers & keep the machine's clock in constant sync.
...

pkg_postinst() {
ewarn "You can find an example /etc/ntp.conf in /usr/share/ntp/"
ewarn "Review /etc/ntp.conf to setup server info."
ewarn "Review /etc/conf.d/ntpd to setup init.d info."
echo
elog "The way ntp sets and maintains your system time has changed."
elog "Now you can use /etc/init.d/ntp-client to set your time at"
elog "boot while you can use /etc/init.d/ntpd to maintain your time"
elog "while your machine runs"


Right! That's the very message which caused me to switch!

Stroller.
 
Old 02-04-2009, 05:20 PM
Stroller
 
Default /etc/init.d/: ntpd or ntp-client?

On 4 Feb 2009, at 14:11, Neil Bothwick wrote:

On Wed, 4 Feb 2009 13:38:11 +0000, Stroller wrote:

So when I found the clock to be a week out of date I checked that
ntpd

appeared to be running (it was) and restarted it. The date remained
the same. Stopping ntpd & starting ntp-client corrected the date
immediately.


ntpd will not change the time if the difference is too large, the man
page gives the limit. You need to run both at boot; ntp-client sets
the
time immediately, no matter what the skew, then ntpd keeps the clock
in

time.


I see. Many thanks.

I am surprised my clock got so far out of whack, having been only
switched off a few days. I don't think the battery is completely dead.
The difference in behaviour seems unexpected, but surely makes sense
from the developers' point-of-view.


I will set both in the default runlevel & keep an eye on things.

Stroller.
 
Old 02-04-2009, 05:23 PM
Justin
 
Default /etc/init.d/: ntpd or ntp-client?

Stroller wrote:
>
> On 4 Feb 2009, at 13:40, Justin wrote:
>> Stroller schrieb:
>>> ...
>>> I understood that ntpd was not only a server for my LAN (a facility I
>>> don't use) but that it would also periodically check the time with
>>> upstream servers & keep the machine's clock in constant sync.
>>> ...
>> pkg_postinst() {
>> ewarn "You can find an example /etc/ntp.conf in /usr/share/ntp/"
>> ewarn "Review /etc/ntp.conf to setup server info."
>> ewarn "Review /etc/conf.d/ntpd to setup init.d info."
>> echo
>> elog "The way ntp sets and maintains your system time has changed."
>> elog "Now you can use /etc/init.d/ntp-client to set your time at"
>> elog "boot while you can use /etc/init.d/ntpd to maintain your time"
>> elog "while your machine runs"
>
> Right! That's the very message which caused me to switch!
>
> Stroller.
>
>
>
so use the ntp-client to set the time at boot and use ntp to keep clock
synced.
 
Old 02-04-2009, 06:09 PM
Stroller
 
Default /etc/init.d/: ntpd or ntp-client?

On 4 Feb 2009, at 18:23, Justin wrote:

Stroller wrote:


On 4 Feb 2009, at 13:40, Justin wrote:

Stroller schrieb:

...
I understood that ntpd was not only a server for my LAN (a
facility I

don't use) but that it would also periodically check the time with
upstream servers & keep the machine's clock in constant sync.
...

pkg_postinst() {
ewarn "You can find an example /etc/ntp.conf in /usr/share/ntp/"
ewarn "Review /etc/ntp.conf to setup server info."
ewarn "Review /etc/conf.d/ntpd to setup init.d info."
echo
elog "The way ntp sets and maintains your system time has
changed."

elog "Now you can use /etc/init.d/ntp-client to set your time at"
elog "boot while you can use /etc/init.d/ntpd to maintain your
time"

elog "while your machine runs"


Right! That's the very message which caused me to switch!

Stroller.

so use the ntp-client to set the time at boot and use ntp to keep
clock

synced.


As I said in my post of 4 February 2009 18:20:50 GMT I will do so.

But I had not initially assumed that "maintaining" the time excluded
the criteria used by ntp-client when setting at boot.


Stroller.
 
Old 02-04-2009, 08:29 PM
Drew Tomlinson
 
Default /etc/init.d/: ntpd or ntp-client?

Neil Bothwick wrote:
> On Wed, 4 Feb 2009 13:38:11 +0000, Stroller wrote:
>
>
>> So when I found the clock to be a week out of date I checked that ntpd
>> appeared to be running (it was) and restarted it. The date remained
>> the same. Stopping ntpd & starting ntp-client corrected the date
>> immediately.
>>
>
> ntpd will not change the time if the difference is too large, the man
> page gives the limit. You need to run both at boot; ntp-client sets the
> time immediately, no matter what the skew, then ntpd keeps the clock in
> time.
>

To avoid running ntp-client and ntpd, look at the -g switch for ntpd.
It will make the big jump once and then keep the clock in sync.

Cheers,

Drew

--
Be a Great Magician!
Visit The Alchemist's Warehouse

http://www.alchemistswarehouse.com
 
Old 02-05-2009, 12:04 PM
Stroller
 
Default /etc/init.d/: ntpd or ntp-client?

On 4 Feb 2009, at 21:29, Drew Tomlinson wrote:

...
To avoid running ntp-client and ntpd, look at the -g switch for ntpd.
It will make the big jump once and then keep the clock in sync.



So NTPD_OPTS="-g" in /etc/conf.d/ntpd ?

Stroller.
 

Thread Tools




All times are GMT. The time now is 12:08 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org