You are not logged in.

#1 2016-02-25 01:11:50

neutronst4r
Member
Registered: 2016-02-25
Posts: 31

[SOLVED] Automatic Logout Script from Wiki not working as intended

Greetings!
I am trying to get this script from the Wiki to work. In the tty consoles it does exactly what it is supposed to, i have tested it. However, it also closes terminal sessions within X. The wiki explicitly says it shouldn't do that.

/etc/profile.d/shell-timeout.sh
TMOUT="$(( 60*10 ))";
[ -z "$DISPLAY" ] && export TMOUT;
case $( /usr/bin/tty ) in
	/dev/tty[0-9]*) export TMOUT;;
esac

Last edited by neutronst4r (2016-02-25 02:25:02)


makepkg not war

Offline

#2 2016-02-25 01:39:14

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] Automatic Logout Script from Wiki not working as intended

As written it will also set TMOUT for every login shell, so if your terminal emulator is a login shell that'd explain your symptoms.  Also, it will export TMOUT to all your terminal emulators if you start X via xinit/startx after you login to a tty.

All around, that "script" seems very fragile.  It might be better to just put the following in your shellrc:

[[ -z "$DISPLAY" ]] && TMOUT=600

"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2016-02-25 02:23:59

neutronst4r
Member
Registered: 2016-02-25
Posts: 31

Re: [SOLVED] Automatic Logout Script from Wiki not working as intended

You are right, they are login shells. But your code snippet seems to do the job just fine. I have put it in /etc/zsh/zshrc so it should logout the root user too, since zsh is the default system shell.

Thank you smile


makepkg not war

Offline

Board footer

Powered by FluxBB