[debian-edu-commits] debian-edu/shutdown-at-night.git (#5) - master (branch) updated: 775e09aa9f0089bd8ad8901056d4c5956a0695a8

Mike Gabriel sunweaver at alioth.debian.org
Wed Oct 23 09:23:47 UTC 2013


The branch, master has been updated
       via  775e09aa9f0089bd8ad8901056d4c5956a0695a8 (commit)
      from  294e2f6ac80b76a414569bfc471b7a1c2b902451 (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 775e09aa9f0089bd8ad8901056d4c5956a0695a8
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Sun Jun 8 16:11:53 2008 +0000

    Improve shutdown script.
    
    git-svn-id: svn+ssh://svn.debian.org/svn/debian-edu/trunk/src/shutdown-at-night@41394 6e500793-9bee-0310-a5b0-9d0909bd054d

-----------------------------------------------------------------------

Summary of changes:
 shutdown-at-night |   30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

The diff of changes is:
diff --git a/shutdown-at-night b/shutdown-at-night
index b00c9a0..2dced23 100755
--- a/shutdown-at-night
+++ b/shutdown-at-night
@@ -4,8 +4,11 @@
 # Should schedule wakeup in the morning.
 
 # How do we decide if it should be enabled for this host?  Netgroup
-# membership? LDAP search?  Flag file?
+# membership?  LDAP search?  Flag file?
 
+wakeuptime="07:00"
+
+hostname=$(uname -n)
 
 enabled_for_host() {
     # Flag for now
@@ -19,29 +22,26 @@ netgroup_lookup() {
     innetgr -h $hostname host-shutdown-at-night
 }
 
-ldap_lookup() {
-    ldapsearch -LLL -w public \
-      -D "cn=svc.adbind,ou=servicekonti,ou=brukere,ou=i2-drift,dc=skolen,dc=local" \
-      -b "dc=skolen,dc=local" \
-      -x "(&(&(objectClass=user)(uidNumber=*))(samaccountname=slxtest0101))" unixhomedirectory
-}
-
 nvramwakeup() {
 # http://www.vdr-portal.de/board/thread.php?threadid=75582&sid=b7aced20e710aef12ffa56b5197fe168
     wakeuptime=$1
     when=$(date +%s -d 'tomorrow $wakeuptime')
 
-    # Make sure HW clock is correct, as it is used to decide when to wake up.
+    # Make sure HW clock is correct, as it is used to decide when to
+    # wake up.
     /etc/init.d/hwclock.sh stop
+
     # Make sure /dev/nvram is available
     modprobe nvram
+
     # This require a supported motherboard
     nvram-wakeup -s $when
+    logger -t shutdown-at-night "Scheduled  $hostname to turn itself on at $wakeuptime."
 }
 
-wolwakeup() {
-    if=eth1
-    ethtool -s $if wol g
+prepare_wakeonlan() {
+    interface="(/sbin/route -n | awk '/^0\.0\.0\.0 / { print $8 }')"
+    ethtool -s $interface wol g
 }
 
 is_host_unused() {
@@ -53,12 +53,12 @@ is_host_unused() {
 }
 
 if enabled_for_host ; then
-    wakeuptime="07:00"
     if is_host_unused; then
-	logger -t shutdown-at-night "Turning off unused client $hostname, turn on at $wakeuptime."
+	logger -t shutdown-at-night "Turning off unused client $hostname."
 	if type nvram-wakeup 2>/dev/null ; then
 	    nvramwakeup $wakeuptime
 	fi
-	shutdown -h now "Unused host being turned off for the night (cron)."
+	prepare_wakeonlan
+	shutdown -h 5 "Unused host being turned off for the night (cron)."
     fi
 fi


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