[debian-edu-commits] r81709 - in trunk/src/shutdown-at-night: . debian

pere at alioth.debian.org pere at alioth.debian.org
Mon Jul 15 15:25:49 UTC 2013


Author: pere
Date: 2013-07-15 15:25:48 +0000 (Mon, 15 Jul 2013)
New Revision: 81709

Modified:
   trunk/src/shutdown-at-night/debian/changelog
   trunk/src/shutdown-at-night/shutdown-at-night
Log:
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)

Modified: trunk/src/shutdown-at-night/debian/changelog
===================================================================
--- trunk/src/shutdown-at-night/debian/changelog	2013-07-15 14:57:18 UTC (rev 81708)
+++ trunk/src/shutdown-at-night/debian/changelog	2013-07-15 15:25:48 UTC (rev 81709)
@@ -2,6 +2,10 @@
 
   * 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
 

Modified: trunk/src/shutdown-at-night/shutdown-at-night
===================================================================
--- trunk/src/shutdown-at-night/shutdown-at-night	2013-07-15 14:57:18 UTC (rev 81708)
+++ trunk/src/shutdown-at-night/shutdown-at-night	2013-07-15 15:25:48 UTC (rev 81709)
@@ -15,6 +15,10 @@
 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 @@
     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
 }
 




More information about the debian-edu-commits mailing list