Bug#767532: shutdown-at-night: Allow systemd to wake up machines in the morning?
Petter Reinholdtsen
pere at hungry.com
Thu Apr 18 00:34:40 BST 2024
I had a closer look, and start to suspect that the rtcwake command is
operating on the same setting as the acpiwakeup() method in the
shutdown-at-night shell script:
# This method might not work if the hardware clock is updated during
# shutdown. Changing /etc/default/hwclock to list HWCLOCKACCESS=yes
# to disable it.
# Based on <URL: http://www.mythtv.org/wiki/ACPI_Wakeup >
acpiwakeup() {
wakeuptime="$1"
if [ -e /sys/class/rtc/rtc0/wakealarm ] ; then
when=$(whentowakeup $wakeuptime)
# First reset alarm
echo 0 > /sys/class/rtc/rtc0/wakealarm
# Next, set it to our selected time
echo $when > /sys/class/rtc/rtc0/wakealarm
logger -t shutdown-at-night "scheduled $hostname to turn itself on at $wakeuptime using /sys/class/rtc/rtc0/wakealarm."
return 0
else
return 1
fi
}
If this is correct, using rtcwake might make this code simpler, but not
add a new way to get the machine to wake up in the morning, which was my
original motivation for creating this issue.
--
Happy hacking
Petter Reinholdtsen
More information about the Debian-edu-pkg-team
mailing list