[debian-edu-commits] debian-edu/shutdown-at-night.git (#53) - master (branch) updated: b9017d8990c2dc97eeb09ac6cdab215778b7d4ca
Mike Gabriel
sunweaver at alioth.debian.org
Wed Oct 23 09:33:58 UTC 2013
The branch, master has been updated
via b9017d8990c2dc97eeb09ac6cdab215778b7d4ca (commit)
from 94be1bd7692ffe9e456e0254db0b2ea515d99e76 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b9017d8990c2dc97eeb09ac6cdab215778b7d4ca
Author: Petter Reinholdtsen <pere at hungry.com>
Date: Sun Jul 21 06:22:05 2013 +0000
Add support for using the ACPI RTC wakeup interface to wake up the
machine (Closes: #717441).
git-svn-id: svn+ssh://svn.debian.org/svn/debian-edu/trunk/src/shutdown-at-night@81778 6e500793-9bee-0310-a5b0-9d0909bd054d
-----------------------------------------------------------------------
Summary of changes:
debian/changelog | 7 +++++++
shutdown-at-night | 31 ++++++++++++++++++++++++++++---
2 files changed, 35 insertions(+), 3 deletions(-)
The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 11ea1e3..855fffc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
diff --git a/shutdown-at-night b/shutdown-at-night
index 0a417b7..5d83a27 100755
--- a/shutdown-at-night
+++ b/shutdown-at-night
@@ -37,12 +37,17 @@ enabled_for_host() {
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 @@ nvramwakeup() {
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 enabled_for_host ; then
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
hooks/post-receive
--
shutdown-at-night.git (shutdown-at-night Debian package)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "shutdown-at-night.git" (shutdown-at-night Debian package).
More information about the debian-edu-commits
mailing list