[plug] Time server
Anthony J. Breeds-Taurima
tony at cantech.net.au
Sat Feb 22 12:02:02 WST 2003
On Thu, 20 Feb 2003, Quintin Lette wrote:
> Any advise on what stage in bootup (ie what file) i should add a request to
> update my clock?
>
> I have written a VERY basic script to update it, but I can't think of the best
> place to put it in bootup. The script is currently run in cron daily, but my
> pc is losing a few hours every reboot and replacing the CMOS battery is just
> too easy and won't fix the problem :)
>
> <script>
>
> #!/bin/sh
> /usr/sbin/ntpdate ntp.debian.localdomain
> hwclock --systohc
>
> </script>
>
> (I have setup a timeserver on a pc within my network which has a similar
> script except using my isp's timeserver and another time server for backup
> and has been saved as /etc/cron.daily/timeupdate)
>
> This obviously has no fault tolerance :( if it doesn't get the correct time it
> will just save the incorrect time in the cmos but that doesn't really worry
> me atm, I would just like to know where to put it in bootup sequence (ie
> which file)
>
> If there is a better way to do this (I'm sure there are millions) please feel
> free to share them.
You might consdier running a ntpd on the local machine. Then point that at
either your local server or your ISP. IT should keep stats on just how bad
the clock is. This'd only really be worthwhile doing if your machines are
on for long perioids at a time.
Back to your original question. Most distros have and rc.local file for just
this reason. I don't seem to have one on my debian box ??
So I would suggest that you create /etc/init.d/rc.local
That contains what ever (probably just your timupdate script), if your keen
you can make it do the "right thing" when passed start/stop type arguments but
it's probably not worth it for your goals, then make a symlink to it like:
cd /etc/rc2.d && ln -s ../init.d/rc.local S99local
Then the next time you bot one of the last things you run will be your script.
If you wanted to get _really_ fancy you could modify /etc/init.d/rcS
to source files in /etc/rclcoal.d/ Then you can just add scipts in there.
Yours Tony.
/*
* "The significant problems we face cannot be solved at the
* same level of thinking we were at when we created them."
* --Albert Einstein
*/
More information about the plug
mailing list