1822781 Members
3986 Online
109645 Solutions
New Discussion юеВ

shell timeout on c shell

 
SOLVED
Go to solution
T G Manikandan
Honored Contributor

shell timeout on c shell

I have a variable called autologout on c shell ,but I don't see any sessions being terminated.
How can I disconnect sessions on the c shell using the TMOUT variable.


Thanks
G Manikandan
10 REPLIES 10
Olav Baadsvik
Esteemed Contributor

Re: shell timeout on c shell


Hi,

I think the TMOUT variablee is for
the ksh and sh shell.
For cshell you will have to set this
variable:

set autologout=60

Regards
Olav


Steve Steel
Honored Contributor

Re: shell timeout on c shell

Hi

You need autologout .

Autologout and Tmout
The C shell, Korn shell, and POSIX shell have an autologout feature. For C shell users, if the "autologout" environment variable is set to a number other than 0, the shell will be logged out after the specified number of minutes have passed. For Korn shell and POSIX shell users, the TMOUT environment variable specifies the number of minutes before the shell logged out. A value of 0 indicates the shell should not be logged out.


What version of HP-UX do you have.

Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Domenico_5
Respected Contributor

Re: shell timeout on c shell

HI t.g.

But is it possible with c shell?

I know how it work on korn and it's this:

/etc/profile is read by all users when they log on. The permissions
on /etc/profile are normally read-only. Thus non-root-capable users
can not change /etc/profile. This is the place the make the change.

Add the following in /etc/profile:

TMOUT=
readonly TMOUT
export TMOUT

In this way the users can't change TMOUNT

bye bye

Deepak Extross
Honored Contributor

Re: shell timeout on c shell

From man csh:
Autologout
A new shell variable has been added called autologout . If the terminal remains idle (no character input) at the shell's top level for a number of minutes greater than the value assigned to autologout ,
you are automatically logged off. The autologout feature is temporarily disabled while a command is executing. The initial value of autologout is 60. If unset or set to 0, autologout is entirely disabled.


Ceesjan van Hattum
Esteemed Contributor

Re: shell timeout on c shell

If 'set autologout=60' is set, but the session does not end after this time, it means that OR you still have some processes running within the shell (or subshell) such as background jobs... OR you did touch the 'any'-key while waiting....
Regards,
Ceesjan
T G Manikandan
Honored Contributor

Re: shell timeout on c shell

Hello,
Even as someone above has mentioned that even if a process is acting it won't termintate the session,then why should it show the session idle time in the finger command.

I have the autologout set to 600.i.e.10min.
But even when I open a session and wait there idle it is not terminating it.

Please help!
Deepak Extross
Honored Contributor

Re: shell timeout on c shell

TG,
The value is in minutes, not seconds.
Deepak Extross
Honored Contributor
Solution

Re: shell timeout on c shell

TG,

It does work.
I switched to c-shell and ran "set autologout=1"
After a minute, csh printed a message "auto-logout" and I was returned to the original shell.

An interesting point is that I was not able to change the value of $autologout using the "setenv autologout 1" syntax. No error reported, but $autologout remained at the default value of 600.
"set autologout=1" did the trick.
H.Merijn Brand (procura
Honored Contributor

Re: shell timeout on c shell

except for a few coupled variables ($path <=> $PATH is an expample), setenv is completely different from set. setenv changes the environment that is passed to other processes (all, not only the shell) whereas set only controls the (t)csh behaviour.

All variables documented in the (t)csh manual pages are to be set using 'set', not 'setenv'

Be aware the some shells support 'readonly', so a variable cannot be changed after that

HTH
Enjoy, Have FUN! H.Merijn
T G Manikandan
Honored Contributor

Re: shell timeout on c shell

Hello,
My setting was autologout=600 which I thought as 600 seconds.
Thanks for confirming that the value is in minutes.

Thanks for all who responded.


Thanks