[debian-edu-commits] debian-edu/shutdown-at-night.git (#11) - master (branch) updated: 7d85cad79c2739a1fd64ca312317611a4d47a2e9

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


The branch, master has been updated
       via  7d85cad79c2739a1fd64ca312317611a4d47a2e9 (commit)
      from  86faa6df4b138fce8622ee90a3e1d83a23de70c0 (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 7d85cad79c2739a1fd64ca312317611a4d47a2e9
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Fri Jun 13 06:39:16 2008 +0000

    Correct typos in the shutdown-at-night script.
    
    git-svn-id: svn+ssh://svn.debian.org/svn/debian-edu/trunk/src/shutdown-at-night@41443 6e500793-9bee-0310-a5b0-9d0909bd054d

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

Summary of changes:
 debian/changelog  |    1 +
 shutdown-at-night |   24 ++++++++++++------------
 2 files changed, 13 insertions(+), 12 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 0704346..1d85c7b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ shutdown-at-night (0.2) UNRELEASED; urgency=low
   * Add server side cron job to start waking up clients at 06:30.
   * Change wakeupclients to log progress, and to check if a client is up
     before trying to wake it.
+  * Correct typos in the shutdown-at-night script.
 
  -- Petter Reinholdtsen <pere at debian.org>  Sun,  8 Jun 2008 18:18:53 +0200
 
diff --git a/shutdown-at-night b/shutdown-at-night
index 2d1f213..2a849f8 100755
--- a/shutdown-at-night
+++ b/shutdown-at-night
@@ -18,48 +18,48 @@ in_netgroup() {
 enabled_for_host() {
     # Flag for now
     if [ -f /etc/shutdown-at-night/shutdown-at-night ] || in_netgroup; then
-        true
+        return 0
     fi
-    false;
+    return 1
 }
 
 nvramwakeup() {
 # http://www.vdr-portal.de/board/thread.php?threadid=75582&sid=b7aced20e710aef12ffa56b5197fe168
     wakeuptime=$1
-    when=$(date +%s -d 'tomorrow $wakeuptime')
+    when=$(date +%s -d "tomorrow $wakeuptime")
 
     # Make sure HW clock is correct, as it is used to decide when to
     # wake up.
-    /etc/init.d/hwclock.sh stop
+    /etc/init.d/hwclock.sh stop > /dev/null
 
     # 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."
+    nvram-wakeup -s $when > /dev/null
+    logger -t shutdown-at-night "scheduled $hostname to turn itself on at $wakeuptime using nvram-wakeup."
 }
 
 prepare_wakeonlan() {
-    interface="(/sbin/route -n | awk '/^0\.0\.0\.0 / { print $8 }')"
+    interface="$(/sbin/route -n | awk '/^0\.0\.0\.0 / { print $8 }')"
     ethtool -s $interface wol g
 }
 
 is_host_unused() {
     # Logged in users, or ldm connection to a remote server
     if [ "$(who)" ] ||  ps -efwww | egrep -q ' ssh .*LTSP_CLIEN[T]' ; then
-	false
+	return 1
     fi
-    true
+    return 0
 }
 
 if enabled_for_host ; then
     if is_host_unused; then
-	logger -t shutdown-at-night "Turning off unused client $hostname."
-	if type nvram-wakeup 2>/dev/null ; then
+	logger -t shutdown-at-night "turning off unused client $hostname."
+	if type nvram-wakeup >/dev/null 2>&1 ; then
 	    nvramwakeup $wakeuptime
 	fi
 	prepare_wakeonlan
-	shutdown -h 5 "Unused host being turned off for the night (cron)."
+	shutdown -h 5 "Unused host being turned off for the night (cron)." < /dev/null > /dev/null 2>&1 &
     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