Hi, this is a feature request: It would be nice to have the possibility to run hwclock --systohc during shutdown. Background: The option CLOCK_SYSTOHC provided by /etc/conf.d/clock is not applicable to most vdr systems, because setting system clock _after_ setting the wake up time breaks most wakeup-methods - the system won't wake up. My approach would be to add a option to /etc/conf.d/vdr.shutdown and add the hwclock-call to /usr/share/vdr/bin/vdrshutdown-really.sh. If that's ok I'm going to post a patch, otherwise advice is appreciated :)
Created attachment 186528 [details, diff] Version 1 of patch, against v0.4.6 This is my first proposal, I hope using the hook mechanism was the right decision. Works for me. Please note that there is currently no gentooish header for the new file pre-shutdown-98-systohc.sh as I'm unsure what to put there.
Why should we blow up the code of gentoo-vdr-scripts? You can find the same feature in Baselayout 1 /etc/conf.d/clock # If you want to set the Hardware Clock to the current System Time # during shutdown, then say "yes" here. CLOCK_SYSTOHC="no" or Baselayout 2 /etc/conf.d/hwclock # If you want to set the Hardware Clock to the current System Time # during shutdown, then say "YES" here. # You normally don't need to do this if you run a ntp daemon. clock_systohc="NO" ???
(In reply to comment #2) > Why should we blow up the code of gentoo-vdr-scripts? Currently, the process of shutting down is the following: 1. VDR shutdown scripts set wakeup time via ACPI or nvram-wakeup 2. VDR shutdown scripts call halt or shutdown or whatever 3a. /etc/init.d/clock stop runs hwclock --systohc if CLOCK_SYSTOHC is enabled --or-- 3b. /etc/init.d/clock stop does nothing if CLOCK_SYSTOHC is disabled On some systems (like mine), 3a. erases the wakeup times set in 1 (system won't wake up). 3b is not desirable, because I want to have an exact host clock. So my proposal is to change the order: 1. VDR shutdown scripts calls hwclock --systohc 2. VDR shutdown scripts set wakeup time 3. VDR shutdown scripts call halt or shutdown or whatever Of course, CLOCK_SYSTOHC has to be set to false in /etc/conf.d/clock for this approach.
@ Stefan plz. unmask gentoo-vdr-scripts-0.4.8_rc2 for testing echo "=media-tv/gentoo-vdr-scripts-0.4.8_rc" >> /etc/portage/package.unmask -- added test that CLOCK_SYSTOHC="no" or clock_systohc="NO" is set on NO/no. plz. leave a short note after testing
I emerged media-tv/gentoo-vdr-scripts-0.4.8_rc2 and it works fine, thank you for including it!
We could try a new approach on this: Just add some init-script that runs at shutdown after(!) clock is stopped. That script then can write the wakeup-time.
(In reply to comment #6) > We could try a new approach on this: > Just add some init-script that runs at shutdown after(!) clock is stopped. > > That script then can write the wakeup-time. Interesting idea, but passing the wake-up time to an init script seems more complicated and error-prone than necessary to me. (Currently I can only imagine that the VDR shutdown scripts write the time to a file that is later read by the init-script. Maybe there's a simpler way.)
(In reply to comment #7) > (In reply to comment #6) > > We could try a new approach on this: > > Just add some init-script that runs at shutdown after(!) clock is stopped. > > > > That script then can write the wakeup-time. > > Interesting idea, but passing the wake-up time to an init script seems more > complicated and error-prone than necessary to me. > > (Currently I can only imagine that the VDR shutdown scripts write the time to a > file that is later read by the init-script. Maybe there's a simpler way.) > Well, as the scripts already pass times around through files I think that could not be worse. Besides I think this is close to the unix concept, to not duplicate stuff but make it clean so that all pieces work together. So we should not duplicate parts of /etc/init.d/clock but just let it work and later save the wakeup time (We also could call "/etc/init.d/hwclock save" instead of coding that).
fixed in media-tv/gentoo-vdr-scripts-0.4.8