[debian-edu-commits] r82666 - in branches/wheezy/shutdown-at-night: . debian

pere at alioth.debian.org pere at alioth.debian.org
Fri Nov 22 22:20:20 UTC 2013


Author: pere
Date: 2013-11-22 22:20:20 +0000 (Fri, 22 Nov 2013)
New Revision: 82666

Modified:
   branches/wheezy/shutdown-at-night/debian/changelog
   branches/wheezy/shutdown-at-night/debian/control
   branches/wheezy/shutdown-at-night/shutdown-at-night
Log:
* Backport fix for #729553 from unstable.
* Rewrite logic checking if a host is unused to look for the KDM,
  Gnome or lightdm login screen to confirm the X sessions are unused
  (Closes: #729553).
* Add depend on x11-utils for the xlsclients tool used to check unused
  X sessions.

Modified: branches/wheezy/shutdown-at-night/debian/changelog
===================================================================
--- branches/wheezy/shutdown-at-night/debian/changelog	2013-11-21 21:44:14 UTC (rev 82665)
+++ branches/wheezy/shutdown-at-night/debian/changelog	2013-11-22 22:20:20 UTC (rev 82666)
@@ -1,3 +1,14 @@
+shutdown-at-night (0.10+deb7u2) UNRELEASED; urgency=low
+
+  * Backport fix for #729553 from unstable.
+  * Rewrite logic checking if a host is unused to look for the KDM,
+    Gnome or lightdm login screen to confirm the X sessions are unused
+    (Closes: #729553).
+  * Add depend on x11-utils for the xlsclients tool used to check unused
+    X sessions.
+
+ -- Petter Reinholdtsen <pere at debian.org>  Fri, 22 Nov 2013 23:13:08 +0100
+
 shutdown-at-night (0.10+deb7u1) wheezy; urgency=low
 
   * Quiet down cron job to wake up client to not complain when fping

Modified: branches/wheezy/shutdown-at-night/debian/control
===================================================================
--- branches/wheezy/shutdown-at-night/debian/control	2013-11-21 21:44:14 UTC (rev 82665)
+++ branches/wheezy/shutdown-at-night/debian/control	2013-11-22 22:20:20 UTC (rev 82666)
@@ -10,7 +10,7 @@
 Package: shutdown-at-night
 Architecture: all
 Depends: ${misc:Depends}, ${perl:Depends},  cron | fcron,
- wakeonlan, ng-utils, fping, ethtool
+ wakeonlan, ng-utils, fping, ethtool, x11-utils
 Recommends: nvram-wakeup
 Suggests: sitesummary (>= 0.0.41)
 Description: System to shut down clients at night, and wake them in the morning

Modified: branches/wheezy/shutdown-at-night/shutdown-at-night
===================================================================
--- branches/wheezy/shutdown-at-night/shutdown-at-night	2013-11-21 21:44:14 UTC (rev 82665)
+++ branches/wheezy/shutdown-at-night/shutdown-at-night	2013-11-22 22:20:20 UTC (rev 82666)
@@ -61,9 +61,27 @@
     ethtool -s $interface wol g
 }
 
+# Return false if X session is confirmed unused (ie login screen is
+# shown).  If not sure, claim it is used to be safe.
+is_xsession_used() {
+    for s in \
+        /var/run/gdm3/auth-for-Debian-gdm-*/database \
+        /var/lib/lightdm/.Xauthority \
+        /var/run/xauth/* \
+        /run/xauth/*; do
+        if [ -e "$s" ] ; then
+            if XAUTHORITY="$s" DISPLAY=:0 xlsclients | egrep -q 'kdmgreet|lightdm-gtk-greeter|razor-lightdm-greeter|lightdm-kde-greeter|gdm-simple-greeter' ; then
+                return 1
+            fi
+        fi
+    done
+    return 0
+}
+
+
 is_host_unused() {
     # Logged in users, or ldm connection to a remote server
-    if [ "$(who)" ] ||  ps -efwww | egrep -q ' ssh .*LTSP_CLIEN[T]' ; then
+    if is_xsession_used || [ "$(who)" ] ||  ps -efwww | egrep -q ' ssh .*LTSP_CLIEN[T]' ; then
 	return 1
     fi
     # Uptime is less than one hour




More information about the debian-edu-commits mailing list