[Sussex] Running command on computer boot

Steve Dobson steve at dobson.org
Mon Nov 21 14:55:52 UTC 2005


John

On Mon, Nov 21, 2005 at 12:57:27PM +0000, Alan Pope wrote:
> On 21/11/05, John Thompson <jdthompson at themutual.net> wrote:
> > I have discovered that if I run the command (in superuser mode):
> >
> > ntpdate time.nist.gov
> >
> > - the clock gets correctly set.
> >
> 
> ntpdate is I believe a bit broken. You might want to switch to the
> "ntp-simple" package instead. You may also want to use a uk based
> server to get your time from.

Alan is wrong here, ntpdate is not broken.  ntpdate is design to set
the systems clock from the given NTP server.  If the system has been
running for some time (weeks, months, ...) then the clock is likely
to be a long way out.  Big jumps in time can cause a problems (esp
jumps backwards) so it *should* *only* be run at boot - which is 
what you want to do.

If your system is up for long periods of time then you should be
running ntpd.  This is a daemon that runs in the background and 
creeps the clock slowly until it is in sync with the reference
NTP servers.  It can also act as an NTP server for other machines
on your local network.

Also watch out if your system is duel boot.  When I install my
Debian systems I'm asked if the RTC is set to GMT.  This is the
way *nix has worked for ever.  The system clock runs on GMT and
then the date function convert this to the local timezone.  As
this can be changed on a per-user basis commands like "ls -l"
"date", ... can report in different timezones for different people.

If you're duel booting Windows (I believe) sets the RTC to local
time and adjusts it when the daylight saving comes into / out of
effect. 

Of course, if the RTC is out because the BIOS battery is dead then 
Windows is screwed unless you install software to update it's clock
like you are for Linux.

> I am guessing you're in the uk, and as such you might want to sync
> with uk.pool.ntp.org.

If you are using just ntpdate then using one local server is the right
thing to do.  If using ntpd a pool of NTP servers is better.

> > Is there any way that I can set things up so that this command
> > automatically runs when the computer boots? Even before the user logs
> > in? Without having to issue the superuser password?

You don't know what system you're running.  If you use debian just
installing the packages is enough, but some local tweaking is best to
pick a good NTP server set.  But adding to the scripts in /etc/init.d 
is one way.  Some systems have a /etc/rc.local for adding any extra
local commands that should only be done once at boot.

Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20051121/7be3893d/attachment.pgp 


More information about the Sussex mailing list