Package: release.debian.org User: [email protected] Usertags: pu Severity: normal
The shutdown-at-night package turn a machine off if it is unused after 16:00 in the evening, and try to turn it automatically on again around 07:00 the next morning. It is used in Debian Edu to allow schools to save power by turning off classrooms at night. Since the release, we have discovered that the version in stable have a fatal flaw, making it unable to detect if a machine is unsused or not when some display managers and desktop environments are used. The proposed patch fixes this, allowing it to detect logged in users on machines using kdm, gdm and lightdm, which are the display managers in use in Debian Edu. The package has migrated from subversion to git, and the current source is now available from <URL: http://anonscm.debian.org/gitweb/?p=debian-edu/pkg-team/shutdown-at-night.git >. The diff is extracted from the wheezy-updates branch there. Is this change OK to upload to stable? Can I correct the control file Vcs entries to point to git or keep the now obsolete svn entries in an upload to proposed-updates? diff --git a/debian/changelog b/debian/changelog index 02dc18b..9ea02a9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +shutdown-at-night (0.10+deb7u2) UNRELEASED; urgency=low + + * Backport from unstable version 0.13 to fix RC bug. + * debian/source/format: + + Add file. Use format 1.0 to match capabilities of Debian Edu's dak. + * 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 <[email protected]> Mon, 24 Mar 2014 10:00:15 +0100 + shutdown-at-night (0.10+deb7u1) wheezy; urgency=low * Quiet down cron job to wake up client to not complain when fping diff --git a/debian/control b/debian/control index abdcf0b..3847689 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Vcs-Browser: http://svn.debian.org/wsvn/debian-edu/trunk/src/shutdown-at-night 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 diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..d3827e7 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +1.0 diff --git a/shutdown-at-night b/shutdown-at-night index c9c97c1..bd6651f 100755 --- a/shutdown-at-night +++ b/shutdown-at-night @@ -61,9 +61,44 @@ prepare_wakeonlan() { ethtool -s $interface wol g } +# Return true if local user is logged in, false otherwise +is_local_user() { + if [ "$(who)" ] ; then + return 0 + else + return 1 + fi +} + +# Return true if ldm login is active +is_active_ldm_session() { + if ps -efwww | egrep -q ' ssh .*LTSP_CLIEN[T]' ; then + return 0 + else + return 1 + fi +} + +# 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 || is_local_user || is_active_ldm_session; then return 1 fi # Uptime is less than one hour @@ -92,4 +127,3 @@ if enabled_for_host ; then else logger -t shutdown-at-night "shutdown-at-night is not enabled for client $hostname." fi - -- System Information: Debian Release: 7.4 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash -- Happy hacking Petter Reinholdtsen -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: https://lists.debian.org/[email protected]

