[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#703710: killer CRON disabled on diskless workstations



On Sat, Oct 18, 2014 at 03:19:57PM +0200, Petter Reinholdtsen wrote:
> [Mike Gabriel]
> > If killer works reliably, then: yes (for diskless workstations).
> 
> As far as I know, it work reliably.  But not quite like you think it
> is working.
> 
> > Otherwise, diskless workstations (not sure about thin clients,
> > actually) will not get affected by shutdown-at-night if users forgot
> > to log out.
> 
> Killer will kill processes for people not logged into the machine, not
> throw out logged in users.  It get rid of leftover processes.
> 
> > The expected behaviour would be for diskless workstations:
> > 
> >   o killer ends still-running / not-logged-off sessions after 6h of
> > session duration
> >   o shutdown-at-night turns of the diskless machine within the next hour
> 
> I am not sure killer is the autologout-mechanism you are looking for.
> shutdown-at-night would work if you had such autologin mechanism.

Hi Mike,

you might want to test if the attached script would work as autologout
mechanism. (I've used it at a local school, so comments are in German.)

Wolfgang
#!/bin/bash
# Datei: /usr/local/bin/timed-logout
# Das Paket 'xprintidle' muss installiert sein.

# Nach $IDLE Millisekunden Inaktivität meldet sich der Benutzer ab; der
# Display-Manager wird neu gestartet und zeigt den Anmeldebildschirm.
#
# Wolfgang Schweer <wschweer@arcor.de, 2013-2018, GPL v2+.

# Der Abmeldemechanismus wird für ein Benutzerkonto wirksam, wenn dort die Datei
# $HOME/.xsessionrc mit dem Inhalt "/usr/local/bin/timed-logout &" existiert.

# Caveat: GNOME verwendet seit Debian 9 (Stretch) Wayland als Voreinstellung;
# xprintidle ist dann wirkungslos (und eine Alternative fand ich nicht).
# Abhilfe: In /etc/gdm3/daemon.conf ein Kommentarzeichen entfernen, um mittels
# 'WaylandEnable=false' Xorg verwenden zu können.

# Anpassen: Die Datei /etc/default/timed-logout erstellen mit dem Inhalt
# IDLE=<gewünschter Wert>.

if [ -r /etc/default/timed-logout ]; then
    . /etc/default/timed-logout
fi
IDLE=${IDLE:-2400000} # Einheit: Millisekunden; voreingestellt: 40 Minuten.

# Warten, bis die Session läuft.
sleep 3

while true; do
if [ $(xprintidle) -gt $IDLE ]; then
    # gdm3 ist auch schon eine gnome-session, zusätzliche Bedingung notwendig.
    if [ -x /usr/bin/gnome-session-quit ] && [ $(ps ax | grep gnome-settings | wc -l) -gt 1 ] ; then
        gnome-session-quit --logout --no-prompt
    elif [ -x /usr/bin/xfce4-session-logout ] ; then
        xfce4-session-logout --logout
    elif [ -x /usr/bin/mate-session-save ] ; then
        mate-session-save --force-logout
    elif [ -x /usr/bin/startkde ] ; then
    # Dies funktioniert für KDE Plasma, ist aber vielleicht zu brutal.
        kquitapp5 ksmserver
    fi
    break
fi
sleep 1
done

Attachment: signature.asc
Description: PGP signature


Reply to: