[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: hwclock --adjust in slink



Quoting E.L. Meijer (Eric) (tgakem@sg10.chem.tue.nl):
> > 
> > I did not fully understand you. Does or doesn't the BIOS get the right time
> > after the system is shutdown?
> 
> The following happens:
> 
> I boot, find the time is lagging behind, and then do a
> 
> hwclock --set --date ...
> 
> This sets the BIOS clock (not the system time), as I can verify with
> 
> hwclock --show
> 
> >From the hwclock manual page I gather it is not adviced to run hwclock
> --hctosys on a running system, although I did it once and it worked
> (X11 went black for a few seconds, but it returned).  I know that the
> hwclock.sh should adjust the clock and copy the BIOS clock to system
> time at boot time (the S..hwclock.sh script) so I reboot.  If I reboot
> to windows98 first, I found that the time was NOT correct, and the BIOS
> clock was lagging just as much as it had been _before_ I set it with
> hwclock --set...  My conclusion is that there must have been some
> process that did a `hwclock --systohc' during shutdown, but I cannot
> find any that does this in the /etc/rc?.d directories.

In a stable/slink system, the file /etc/init.d/hwclock.sh contains
the following snippet:

        stop|restart|reload)
                [ "$GMT" = "-u" ] && GMT="--utc"
                hwclock --systohc $GMT
                if [ "$VERBOSE" != no ]
                then
                        echo "CMOS clock updated to `date`."
                fi
                ;;

I don't remember when this was added to Debian. All my systems run ntp
except the one at home where I have disabled the section above.

> > In any case, there are hw K scripts:
> > [18:17:27 /tmp]$  ls /etc/rc?.d/*hw*
> > /etc/rc0.d/K25hwclock.sh  /etc/rc6.d/K25hwclock.sh  /etc/rcS.d/S50hwclock.sh
> > [18:22:27 /tmp]$ 
> > 
> > Note that your system somehow got S instead of K for rc0 and rc6.
> > I am running unstable.
> 
> On two different systems running slink I only have the S..hwclock.sh
> scripts, so I guess this has changed in unstable.  Having the K..
> scripts run at shutdown would give the symptoms I described, but my
> system doesn't have them, so I don't understand what is happening.
> I have version 2.9g-6 of util-linux.

They run all right. hwclock just precedes the random seed.

So knowing I *had* to find something that runs it, I found:

/usr/doc/sysvinit/README.runlevels.gz
5. Halt/reboot
penultimate paragraph

   Then the /etc/rc6.d/SXXxxxx scripts will be executed alphabetically
   with "stop" as the first argument as well. The reason is that there
   is nothing to start anymore at this point - all scripts that are
   run are ment to bring the system down.

Working out whether and when to run things like hwclock --systohc $GMT
at reboot is something I've always meant to look at on a rainy
afternoon. The trouble is, it's never rained enough!

Cheers,

-- 
Email:  d.wright@open.ac.uk   Tel: +44 1908 653 739  Fax: +44 1908 655 151
Snail:  David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA
Disclaimer:   These addresses are only for reaching me, and do not signify
official stationery. Views expressed here are either my own or plagiarised.


Reply to: