[debian-edu-commits] debian-edu/ 51/64: Add support for extending the "busy" detection in shutdown-at-night by adding code to run hooks in /etc/shutdown-at-night/unused.d and /usr/lib/shutdown-at-night/unused.d. (Closes: #619950)

Mike Gabriel sunweaver at debian.org
Wed Oct 23 09:51:56 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 19c7ab6e1d49ca2dcadd27d5fb400cfe9c0efb6a
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Mon Jul 15 15:25:48 2013 +0000

    Add support for extending the "busy" detection in
    shutdown-at-night by adding code to run hooks in
    /etc/shutdown-at-night/unused.d and
    /usr/lib/shutdown-at-night/unused.d. (Closes: #619950)
    
    git-svn-id: svn+ssh://svn.debian.org/svn/debian-edu/trunk/src/shutdown-at-night@81709 6e500793-9bee-0310-a5b0-9d0909bd054d
---
 debian/changelog  |    4 ++++
 shutdown-at-night |   13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index c93f3af..e868ca6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,10 @@ shutdown-at-night (0.11) UNRELEASED; urgency=low
 
   * Quiet down cron job to wake up client to not complain when fping
     notice they are unavailable.
+  * Add support for extending the "busy" detection in
+    shutdown-at-night by adding code to run hooks in
+    /etc/shutdown-at-night/unused.d and
+    /usr/lib/shutdown-at-night/unused.d. (Closes: #619950)
 
  -- Petter Reinholdtsen <pere at debian.org>  Mon, 15 Jul 2013 16:56:35 +0200
 
diff --git a/shutdown-at-night b/shutdown-at-night
index c9c97c1..0a417b7 100755
--- a/shutdown-at-night
+++ b/shutdown-at-night
@@ -15,6 +15,10 @@ wakeuptime="07:00"
 hostname="$(uname -n)"
 netgroupname="shutdown-at-night-hosts"
 
+# Hook directories to allow custom code to detect if a machine is used
+# or not.
+unuseddlist="/etc/shutdown-at-night/unused.d /usr/lib/shutdown-at-night/unused.d"
+
 in_netgroup() {
     # Try both long and short name
     for h in "$(uname -n)" "$(hostname -s)" ; do
@@ -70,6 +74,15 @@ is_host_unused() {
     if (( $(cat /proc/uptime  | awk '{print int($1)}') < 3600 )) ; then
         return 1
     fi
+    for dir in $unuseddlist ; do
+	if [ -d $dir ] ; then
+            for f in $dir/* ; do
+		if [ -x $f ] && ! $f ; then
+                    return 1
+		fi
+            done
+	fi
+    done
     return 0
 }
 

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