[debian-edu-commits] debian-edu/ 01/01: Provide support for usage via flag file. + Add shutdown-at-night.default to enable configuration. + Adjust the code to make configuration possible.

Wolfgang Schweer schweer-guest at moszumanska.debian.org
Sat Oct 17 18:19:19 UTC 2015


This is an automated email from the git hooks/post-receive script.

schweer-guest pushed a commit to branch master
in repository shutdown-at-night.

commit f21300e21805f2c5d6974f59188150b6a6405d7e
Author: Wolfgang Schweer <wschweer at arcor.de>
Date:   Sat Oct 17 20:18:22 2015 +0200

    Provide support for usage via flag file.
     + Add shutdown-at-night.default to enable configuration.
     + Adjust the code to make configuration possible.
---
 debian/changelog          |  3 +++
 shutdown-at-night         | 16 +++++++++++++---
 shutdown-at-night.default |  6 ++++++
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3cf6d35..ab226e6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,9 @@ shutdown-at-night (0.17) UNRELEASED; urgency=medium
 
   * Fix typos in xsession test.
   * Fix typo in acpiwakeup code.
+  * Provide support for usage via flag file.
+    + Add shutdown-at-night.default to enable configuration.
+    + Adjust the code to make configuration possible.
 
  -- Wolfgang Schweer <wschweer at arcor.de>  Sat, 17 Oct 2015 19:25:29 +0200
 
diff --git a/shutdown-at-night b/shutdown-at-night
index af2260e..dd58119 100755
--- a/shutdown-at-night
+++ b/shutdown-at-night
@@ -27,7 +27,15 @@
 
 #set -e
 
-wakeuptime="07:00"
+WAKEUPTIME="07:00"
+NVRAM_WAKE_ENABLED="no"
+ACPI_WAKE_ENABLED="no"
+
+if [ -r /etc/default/shutdown-at-night ]; then
+    . /etc/default/shutdown-at-night
+fi
+
+wakeuptime="$WAKEUPTIME"
 
 hostname="$(uname -n)"
 netgroupname="shutdown-at-night-hosts"
@@ -181,10 +189,12 @@ fatal() {
 if enabled_for_host ; then
     if is_host_unused; then
         logger -t shutdown-at-night "turning off unused client $hostname."
-        if type nvram-wakeup >/dev/null 2>&1 ; then
+        if [ type nvram-wakeup >/dev/null 2>&1 ] && [ "$NVRAM_WAKE_ENABLED" = yes ] ; then
             nvramwakeup $wakeuptime
         fi
-        acpiwakeup $wakeuptime
+        if [ "$ACPI_WAKE_ENABLED" = yes ] ; then
+            acpiwakeup $wakeuptime
+        fi
         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
diff --git a/shutdown-at-night.default b/shutdown-at-night.default
new file mode 100644
index 0000000..ad2b61c
--- /dev/null
+++ b/shutdown-at-night.default
@@ -0,0 +1,6 @@
+# These are the defaults for standalone usage.
+WAKEUPTIME="07:00"
+# nvram-wake works only for special mother boards.
+NVRAM_WAKE_ENABLED="no"
+# Using the real time clock wakealarm feature should work in most cases.
+ACPI_WAKE_ENABLED="no"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/shutdown-at-night.git



More information about the debian-edu-commits mailing list