[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [cobalt-users] Time funked out after reboot
- Subject: RE: [cobalt-users] Time funked out after reboot
- From: Dave Bonnell <davebonnell@xxxxxxxxx>
- Date: Mon Aug 26 19:30:01 2002
- List-id: Mailing list for users to share thoughts on Sun Cobalt products. <cobalt-users.list.cobalt.com>
Hello,
Thanks to everyone for the information on this one.
This is what I have concluded:
Setting the time on a linux box has two parts.
There are plenty of guides around the net about this. Say
http://www.tldp.org/HOWTO/mini/Clock.html
Also man hwclock has some good information.
The basic steps are
1. Set the system time (date, ntpdate, rdate, or the command of your liking)
2. Set the hardware time.
When the system reboots it will read the hardware time and set the system time.
The /etc/rc.d/rc.sysinit script does this. If one looks at the code it reads
the hardware time in UTC. Also /etc/adjtime has a compensation factor to keep
the system time and hardware time aligned. This file on my systems was wacked
out.
The bizarre dates I was getting upon reboot were the hardware clock time
adjusted by /etc/adjtime. It was *way* off. When setting time from the admin
interface apparently it only sets the system time and never the hardware time.
So to get things back to "normal"
1. Delete the adjustment file
rm /etc/adjtime
2. Set the system time. I used "ntpdate"
/usr/sbin/ntpdate -b -p 8 216.27.190.202 204.74.68.55 63.19.96.3 132.239.254.49
26 Aug 18:57:38 ntpdate[952]: step time server 216.27.190.202 offset 134.516337
sec
3. Set the hardware clock
/sbin/hwclock --systohc --utc
4. Do an initial setting of the ajdtime file
/sbin/hwclock --adjust
5. Check it out
cat /etc/adjtime
Since I am a minimalist and do not want ntpd running all the time I also have
added a cron job to /etc/cron.daily to run every night and set both the system
and hardware date/time.
This is basically:
/sbin/hwclock -r;/usr/sbin/ntpdate -b -p 8 216.27.190.202 204.74.68.55
63.192.96.3 132.239.254.49; /sbin/hwclock --adjust; /sbin/hwclock --systohc
--utc; /sbin/hwclock -r
Setting the time in rc.local is an idea as well but this never fixes the
hardware time which will funk out files touched booting until the system gets
to rc.local. Perhaps I could set the hardware time on shutdown but what I have
now is working
My 2 cents.
-d
--- "Jolley, Carl" <Carl.Jolley@xxxxxxx> wrote:
> -----Original Message-----
> From: Dave Bonnell
> To: cobalt-users@xxxxxxxxxxxxxxx
> Sent: 8/24/02 2:48 PM
> Subject: [cobalt-users] Time funked out after reboot
>
> Hello,
>
> After I reboot any of my RAQ3i systems the date/time ends up at some
> time in
> the distant future.
>
> Prior to reboot I check the date/time through the admin console and the
> unix
> data command and it is correct. After my most recent reboot it came
> back with
> Jan 6 2003 as the date.
>
> If I then manually correct the date back I have a number of files that
> have
> been tagged with this future date. I have to restart cron to get things
> working again and hope that none of the files that have been touched
> with this
> future date will cause problems.
>
> Anyone have a clue how I can fix this? Is the clock battery dead?
> -------------
> I too, have had this problem. I don't think that the clock
> battery replacement is _necessarily_ the solution to this
> problem. The "root" of the problem is that the real-time
> clock on the Raq3 is crap.
>
> I have an ntp server congifured via my /etc/crontab to run
> every 15 minutes. Still, this is not sufficient. My eventual
> solution was to patch the /etc/rc.d/init.d/crond script to
> do an npt time check prior to starting. Since crond is
> started after a reboot, this insures that the time is correct
> before crond gets fired up and wildly begins to run crontable
> entries because it "thinks" its later than it really is.
> The patched portion of my crond stript looks like:
>
> # See how we were called.
> case "$1" in
> start)
> /usr/sbin/ntpdate ntp.cmr.gov >>/var/cobalt/sauce.log 2>&1
> /sbin/clock -w -u >>/var/cobalt/sauce.log 2>&1
> echo -n "Starting cron daemon: "
> daemon crond
>
> The two lines prior to the echo command was what I inserted.
>
> The lastlog (e.g. last reboot) may show the incorrect time
> when the boot was done but the change in the crond script
> should fix the problem before crond starts running and
> firing up programs with the clock set wrong.
__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com