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

Re: Bug#703710: killer CRON disabled on diskless workstations



On Sat, Oct 18, 2014 at 12:48:08PM +0000, Mike Gabriel wrote:
> If killer works reliably, then: yes (for diskless workstations). Otherwise,
> diskless workstations (not sure about thin clients, actually) will not get
> affected by shutdown-at-night if users forgot to log out.
> 
> 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

You could use xprintidle for the first goal.

Put the script as 'timed-logout' into /usr/local/bin and call it in the users 
.xsessionrc like this: '/usr/local/bin/timed-logout &'
------------------------------------------------------
#!/bin/bash
#
# Force logout after $IDLE/1000 sec inactivity.
#
IDLE=3600000 # unit: millisec.
#
# Wait until the session is running.
sleep 3
# For Xfce, KDE Plasma, Gnome, LXDE.
while true; do
if [ "$(xprintidle)" > $IDLE ]; then
  if [ -x /usr/bin/xfce4-session-logout ] && [ $(ps ax | grep xfce | wc -l) -gt 1 ] ; then
    xfce4-session-logout --logout                             # Xfce
  elif [ -x /usr/bin/ksmserver ] && [ $(ps ax | grep ksmserver | wc -l) -gt 1 ] ; then
    qdbus org.kde.ksmserver /KSMServer logout 0 0 0                                     # KDE
  elif [ -x /usr/bin/gnome-session-quit ] && [ $(ps ax | grep gnome-settings | wc -l) -gt 1 ] ; then
    gnome-session-quit --logout --no-prompt             # Gnome
  elif [ -x /usr/bin/lxsession ] && [ $(ps ax | grep lxsession | wc -l) -gt 1 ] ; then
    pkill lxsession                                     # LXDE
  fi
break
fi
sleep 1
done
---------------------------------------------------------------
For console sessions put this as timeout.sh into /etc/profile.d
---------------------------------------------------------------
# For bash shell, useless for X.
#
# Time in sec.
TMOUT=1200

# Optiobal: don't allow users to change the timeout value.
#readonly TMOUT

export TMOUT
---------------------------------------------------------------

Untested.

Wolfgang

Attachment: signature.asc
Description: Digital signature


Reply to: