[debian-edu-commits] r81778 - in trunk/src/shutdown-at-night: . debian
pere at alioth.debian.org
pere at alioth.debian.org
Sun Jul 21 06:22:05 UTC 2013
Author: pere
Date: 2013-07-21 06:22:05 +0000 (Sun, 21 Jul 2013)
New Revision: 81778
Modified:
trunk/src/shutdown-at-night/debian/changelog
trunk/src/shutdown-at-night/shutdown-at-night
Log:
Add support for using the ACPI RTC wakeup interface to wake up the
machine (Closes: #717441).
Modified: trunk/src/shutdown-at-night/debian/changelog
===================================================================
--- trunk/src/shutdown-at-night/debian/changelog 2013-07-20 20:49:25 UTC (rev 81777)
+++ trunk/src/shutdown-at-night/debian/changelog 2013-07-21 06:22:05 UTC (rev 81778)
@@ -1,3 +1,10 @@
+shutdown-at-night (0.12) UNRELEASED; urgency=low
+
+ * Add support for using the ACPI RTC wakeup interface to wake up the
+ machine (Closes: #717441).
+
+ -- Petter Reinholdtsen <pere at debian.org> Mon, 15 Jul 2013 17:26:08 +0200
+
shutdown-at-night (0.11) unstable; urgency=low
* Quiet down cron job to wake up client to not complain when fping
Modified: trunk/src/shutdown-at-night/shutdown-at-night
===================================================================
--- trunk/src/shutdown-at-night/shutdown-at-night 2013-07-20 20:49:25 UTC (rev 81777)
+++ trunk/src/shutdown-at-night/shutdown-at-night 2013-07-21 06:22:05 UTC (rev 81778)
@@ -37,12 +37,17 @@
return 1
}
+whentowakeup() {
+ wakeuptime=$1
+ # Spread the BIOS wakeup time across a 20 minute period, to avoid
+ # all of them waking up at the same time, killing a fuse.
+ echo $(( $(date -u +%s -d "tomorrow $wakeuptime") - 600 + $RANDOM % 1200))
+}
+
nvramwakeup() {
# http://www.vdr-portal.de/board/thread.php?threadid=75582&sid=b7aced20e710aef12ffa56b5197fe168
wakeuptime=$1
- # Spread the BIOS wakeup time across a 20 minute period, to avoid all of them
- # waking up at the same time, killing a fuse.
- when=$(( $(date +%s -d "tomorrow $wakeuptime") - 600 + $RANDOM % 1200))
+ when=$(whentowakeup $wakeuptime)
# Make sure HW clock is correct, as it is used to decide when to
# wake up.
@@ -60,6 +65,25 @@
fi
}
+# This method might not work if the hardware clock is updated during
+# shutdown. Changing /etc/default/hwclock to list HWCLOCKACCESS=yes
+# to disable it.
+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
+ return 0
+ else
+ return 1
+ fi
+}
+
prepare_wakeonlan() {
interface="$(/sbin/route -n | awk '/^0\.0\.0\.0 / { print $8 }')"
ethtool -s $interface wol g
@@ -97,6 +121,7 @@
if type nvram-wakeup >/dev/null 2>&1 ; then
nvramwakeup $wakeuptime
fi
+ acpiwakeup $waketime
prepare_wakeonlan || fatal "unable to enable wake-on-lan - aborting shutdown."
shutdown -h 5 "Unused host being turned off for the night (cron)." < /dev/null > /dev/null 2>&1 &
else
More information about the debian-edu-commits
mailing list