Operating System - HP-UX
1833648 Members
5028 Online
110062 Solutions
New Discussion

Re: How to disconnect (console) sessions it not used for a period of time?

 
SOLVED
Go to solution
Angel_17
Occasional Contributor

How to disconnect (console) sessions it not used for a period of time?

I would like to kill a console session if I don't use the keyboard for a period of time, because some times I've forgotten to close the root session (I know, I'm very...)

I know how to kill the session, but I don't know how to determine if a console is idle or not.

Is there an environment variable that count the time since the keyboard was used for the last time?

I could do an script called from the cron every 5 minutes if I knew that.


Thank you very much!!
6 REPLIES 6
Joseph Loo
Honored Contributor
Solution

Re: How to disconnect (console) sessions it not used for a period of time?

hi,

use TMOUT parameter in /etc/profile (for all users) or /~username/.profile (individual user).

For example,

TMOUT=1800
readonly TMOUT

this will terminate the idle session after 1800 seconds.

regards.
what you do not see does not mean you should not believe
Angel_17
Occasional Contributor

Re: How to disconnect (console) sessions it not used for a period of time?

Thanks Joseph,
is that a common feature to all the flavours of UNIX? I would like to use it on SCO OpenServer as well.
Joseph Loo
Honored Contributor

Re: How to disconnect (console) sessions it not used for a period of time?

hi,

not too sure if other UNIX flavors (i think Solaris and AIX does) also support this.

u may like to test it though.

regards.
what you do not see does not mean you should not believe
Angel_17
Occasional Contributor

Re: How to disconnect (console) sessions it not used for a period of time?

Thanks, I will do it.
Mobeen_1
Esteemed Contributor

Re: How to disconnect (console) sessions it not used for a period of time?

Angel,
AIX support it

rgds
Mobeen
Gordon  Morrison
Trusted Contributor

Re: How to disconnect (console) sessions it not used for a period of time?

The TMOUT environment variable is a built-in feature of ksh and Posix shells. Possibly Bourne shell as well, but I can't say for certain.
It is not supported in csh (what is?;o), but csh has it's own version of a similar idea.
I don't know about other shells.
What does this button do?