• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Running ntpdate at boot  (Read 1437 times)
loonsailor
Newbie
*

Karma: 0
Posts: 9


View Profile
« on: June 17, 2009, 07:54:47 AM »

I'm using my Sheeva to run wview, a great open source weather station package.  It is run from an init.d script at boot time.  Unfortunately, it fails to run at boot, though the script works fine and can be run manually.  The problem is that wview needs time to be set accurately, because it keeps a database of weather station readings that is time based, and sync's the time with the station.

Because the Sheeva doesn't have a persistent RTC with battery backup, when it first powers on the time can be off by months.  I run ntpd as part of the boot, but ntpd "should" be started when the time is already reasonable.  It does sync eventually, but it takes too long.  By then, wview has run and failed, even though it's the last thing in the boot sequence.  Right now, I've got a fix kludged, which is to run ntpdate-debian in rc.local as suggested by http://www.openplug.org/plugwiki/index.php/New_Plugger_How_To, and then to run wview AFTER rc.local.  That works, but it doesn't seem right, because, by convention at least, rc.local should be the last thing to run at boot time before the login prompt.  It works, but...

I think the correct fix is to run ntpdate (or ntpdate-debian?) as an independently sequenced init.d script, probably in rc0.d shortly after the network comes up.  I'm surprised that I haven't seen any suggestion or discussion of this before.  I know that init.d scripts usually start daemons, and in this case there is no daemon to start, but it does seem like the right place to do it.  Maybe it hasn't been a general problem because, unless one is running wview, nothing else at boot time relies on an accurate time.

Am I missing something, or mis-analyzing the problem?

BTW, I'm running the default released ubuntu 2.6.22.18.  Has anything changed in this regard in the new release candidates?
« Last Edit: June 17, 2009, 08:12:08 AM by loonsailor » Logged

restamp
Global Moderator
Sr. Member
*****

Karma: 4
Posts: 273


View Profile
« Reply #1 on: June 17, 2009, 11:35:52 AM »

Are you sure that the Sheeva doesn't have a battery backed-up RTC?  Take a look at:

http://www.globalscaletechnologies.com/t-sheevaplugdetails.aspx#component

This reference seems to indicate it has one.  Also, take a look at /etc/rcS.d/S08hwclockfirst.sh and /etc/rcS.d/S11hwclock.sh, which is where I believe the OS sets its TOD clock from.

FWIW, my Plug seemed to boot up the first time with some reasonable idea of what the time was, and has remained pretty much spot-on after I tweaked it -- I just checked it, and it was w/i 1/3 of a second of network time -- even after many reboots and being unplugged momentarily a couple of times.
Logged

scruss
Newbie
*

Karma: 0
Posts: 17


View Profile WWW
« Reply #2 on: June 18, 2009, 06:15:59 PM »

A battery-backed RTC isn't good enough for general data logging. Install openntpd - it will keep your clock on time, every time.
Logged

hug a wind turbine today!

Pages: [1]
Print
Jump to: