On 20/11/2012 1:47 PM, Gilbert E. Detillieux wrote:
Actually, RHEL5 has the following line in /etc/init.d/halt...
[ -x /sbin/hwclock ] && action $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS
The value of CLOCKFLAGS is calculated earlier in the same script, based on the UTC and ARC variables set in the /etc/sysconfig/clock config file. A similar line exists in the halt script in RHEL6, except it no longer sources /etc/sysconfig/clock, but just has a hard-coded option.
That seems to have disappeared with the switch to systemd in Fedora. So, the best bet seems to be to configure ntpdate to work correctly, so you at least get the clock synch'ed on startup.
I missed that in my grepping. I was looking for the K* script links in /etc/rc.d/rc?.d, forgetting that when you're halting or shutting down, you're actually *starting* run level 0 or 6, so it's the S??halt or S??reboot link that gets run.
What I found for systemd on F17 is the /usr/lib/systemd/system-shutdown directory. According to this page: http://www.freedesktop.org/software/systemd/man/systemd-halt.service.html, "Immediately before executing the actual system halt/poweroff/reboot/kexec systemd-shutdown will run all executables in /usr/lib/systemd/system-shutdown/ and pass one arguments to them: either "halt", "poweroff", "reboot" or "kexec", depending on the chosen action. All executables in this directory are executed in parallel, and execution of the action is not continued before all executables finished." So, presumably one could add a little script there to run hwclock --systohc right before shutdown/reboot. And since the warring ideologues can't be counted on to put it there for you in the distro, I guess it's up to us pragmatists to do it ourselves. :-)