[debian-edu-commits] debian-edu/ 11/64: Correct typos in the shutdown-at-night script.

Mike Gabriel sunweaver at debian.org
Wed Oct 23 09:51:49 UTC 2013


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

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

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
---
 debian/changelog  |    1 +
 shutdown-at-night |   24 ++++++++++++------------
 2 files changed, 13 insertions(+), 12 deletions(-)

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

-- 
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