El 2003-07-09 a las 13:37, C Hamel escribió: (You forgot to post to the list)
I am afraid I don't even know how to ask a question, at this point, but I'll make an attempt: Exactly where should this ntp thing be called to set the clock ...or(/and) by what process?
It is a very proper question :-) Well, it depends. There are two ways. If your computer is up all the time, and has a permanent network connection, you can use the ntpd daemon, which polls a set of servers about once a minute, and _very_ slowly adjusts the system clock; it can even note the systematic error or drift, and take that in to account to discipline the system clock. There are many options available for the daemon: see full doc in: http://localhost/usr/share/doc/packages/xntp-doc/html/index.htm Or, you may have a temporary network connection, like I do; I will explain this in some detail. We can adjust the clock to "internet" time, once, sometime after we connect to internet. This, apparently, can be done with the daemon, using some option I don't fully understand. Or we can use ntpdate - a program which is to disappear some time in the future, but that I use, and SuSE uses as well in its own script. For this, we can simply call "/etc/init.d/xntpd ntptimeset" - and assume that when "ntpdate" finally disappears SuSE will adjust the script appropriately ;-) Of course, /etc/ntp.conf has to be configured; at least, it must have a list of servers: server IP_address server name_address This is sufficient for "xntpd ntptimeset" to work; just leave the rest of the config at the default values. If you want to use the daemon, then I'm not the person to ask :-) Ok, so when is the appropriate time to make this time adjust? Well, ideally, during system boot-up, after network connection is established. This is done properly by the service xntpd, if enabled. The SuSE script "/etc/init.d/xntpd start" does first a clock set using ntpdate, if the variable XNTPD_INITIAL_NTPDATE is set to "AUTO". Then, it starts the daemon to keep time synchronized. And, if our network connection is not permanent? Then, the script "/etc/ppp/poll.tcpip", which is called from "/etc/ppp/ip-up", will adjust the clock first thing: assuming we have some servers configured, it will be done every time we connect to internet with the modem. I do it differently, only once every five times, and I also update the hwclock. The danger of this method is that the clock might suddenly go forward or backward a bit (seconds or hours, it depends): not very nice on a *nix system, but we can not avoid it. More details to be aware of: what happens to the hardware or CMOS clock? Well, the script "/etc/init.d/boot.clock" (read it, it is documented) does this sequence of things (using the command "hwclock") before starting system services: - Create if it doesn't exist, the file "/etc/adjtime" - Adjust hardware clock (CMOS) for known drift during the time the computer has been off; this depends on the previous file to work. - Copy CMOS clock (hardware) to system time (CPU and OS maintained). After this, the system goes fully up, and maybe, the clock is adjusted from the internet or by hand (danger!). But (and this is very different than windows) the CPU maintained clock has to be copied back to the CMOS, because the kernel doesn't do it. SuSE does it in the script "/etc/init.d/halt" that copies system time to hardware time just before power off. Me, I prefer to do it just after I adjust to network time, inside "ip-up.local", like this: /usr/sbin/rcxntpd ntptimeset /sbin/hwclock --systohc More things to be aware of: a common mistake is manually adjusting the system clock from kde control center (for example), and not updating the hwclock at the same time: the drift adjust algorithm of hwclock thinks that the CMOS clock is fast or slow by the same amount you adjusted the clock, and the next boot it will adjust the time by several hours... The solution is to delete "/etc/adjtime" and call "/sbin/hwclock --systohc" just then (documented on the SuSE sdb). Well, this has been enough chatter on my part; let's hope I didn't make many mistakes :-) -- Saludos Carlos Robinson