Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TIMEOUT variable in bourne shell

Status
Not open for further replies.

joekwchen

MIS
Oct 3, 2002
17
0
0
US
Hi all

I'm using Solaris and I need to set the TIMEOUT variable in bourne shell (/sbin/sh). I've read somewhere and it's supposed to be TIMEOUT=5;export TIMEOUT
but it doesn't work.

TMOUT on ksh works perfectly.

Does anyone know how to set timeout in bourne shell?

Thanks.

 
What is the value of $SHELL when you're doing this. It might make a difference.
 
Looks like this functionality is not available in Solaris Bourne Shell. I believe it should have been introduced at SVR4.2. It only works in Korn and Bash shells on Solaris.

From SUN Infodoc ID14089...

A) The login session.
The entry in the /etc/default/login file:

# TIMEOUT sets the number of seconds (between 0 and 900) to wait before
# abandoning a login session.
#
#TIMEOUT=300

defines the number of seconds the login process will wait on an attempted login for a response to the login prompt. For example, if you have the TIMEOUT value set to 120, then when you &quot;telnet <hostname>&quot;, you will have 120 seconds, or 2 minutes, to enter a login name before it closes the connection.

The default is 300 seconds, or 5 minutes.


B) The shell session. (Korn and Bash shells only, /usr/bin/ksh and /usr/bin/bash)

The TMOUT environment variable is what controls Korn and Bash shell inactivity timeout. If it is unset, or has a value of 0, then timeout is disabled. If it is set to a value greater than zero, then the shell will terminate if a command is not entered in the specified number of seconds in the TMOUT variable.

The TMOUT variable can be set in /etc/profile for all users, or in an individual's $HOME/.profile.

Note: There is no TMOUT equivalent for either the bourne (/bin/sh) or C (/bin/csh) shells. Also, it only works for login sessions which use simple shells (like telnet or rlogin). It will NOT automatically logout from a CDE or Openwindows session. However, if the TMOUT variable is set in /etc/profile as shown above, any terminal window within CDE will exit after exceeding the TMOUT idle value. That might not be a desirable thing.

 
Ken
my $SHELL is /sbin/sh

Julian
Thanks for your comment. Can I say that there's no TMOUT equivalent for Solaris Bourne shell? (I'm using Solaris 8)

Thanks all.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top