LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-15-2009, 07:49 AM   #1
Hi_This_is_Dev
Member
 
Registered: May 2009
Location: India
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254

Rep: Reputation: 18
Question Flagging a Warning Message with TMOUT


Hi All,


I have just come to know that we can use the environmental variable TMOUT to set an idle time in seconds after which any inactive session is automatically logged out.

In order to achieve this, we can do the following:

Edit /etc/profile file and write the line:

Code:
TMOUT=3600
This will log out any user who has been inactive for 1 hour.

Well, can we do something more with it? I mean, can we flag a warning message on the user's screen just before logging him/her out? Such as: Your session will be automatically logged out in .. seconds.

Any creative ideas?


Regards,
Dev.
 
Old 05-15-2009, 08:50 AM   #2
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
A search for the tmout flagged threads found one suggesting a script based on the who command or just changing to the ksh as your default, and the ksh gives a 1 minute warning message prior to terminating the shell.

Note, however, that the TMOUT variable is a shell-specific setting, not a session-specific one. If you look at the output of who -uT you'll see something like this:
Code:
$ sudo who -uT
[sudo] password for Peter:
Peter    ? :0           2009-05-15 05:58   ?          2658
Peter    + pts/0        2009-05-15 05:59 00:37        2756 (:0)
Peter    - pts/1        2009-05-15 06:23   .          5261 (:0.0)
Note that the X-session (:0) is flagged as having an "unknown" message reception state, and an unknown idle time.

Bottom line: I think you'll need to write a "widget" to monitor your X-server activity and add it to the X-server init script if you want to be able to automatically terminate an idle X session.

Or, here's a thought: Use one of the power management applications, and set the actions you want to happen after specific idle times.
 
Old 05-16-2009, 05:58 PM   #3
Hi_This_is_Dev
Member
 
Registered: May 2009
Location: India
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254

Original Poster
Rep: Reputation: 18
Okay, I will try that and post here my finding. Thanks a lot!
 
  


Reply

Tags
message, warning



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shutdown warning message? DotHQ Linux - General 2 11-20-2008 08:58 AM
su - root and TMOUT perrymans Linux - Software 1 11-01-2008 04:45 AM
Flagging exits in Bash Script dtheorem Programming 5 11-08-2003 10:15 PM
why warning message is appear? eye Red Hat 3 10-22-2003 09:14 AM
Warning Message at startup onlyhuman9 Linux - General 1 11-29-2001 10:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration