Operating System - HP-UX
1833589 Members
4266 Online
110061 Solutions
New Discussion

Session time out on HPUX machine

 
SOLVED
Go to solution
Ferdie Banu
Occasional Contributor

Session time out on HPUX machine

I would like to know how to set idle session time-out and check the timeout setting on HP-UX. But then if its a batch then the session should not be terminated. Any shared scripts regarding this matter will be much appreciated.

Thanks in advance.
6 REPLIES 6
curt larson_1
Honored Contributor

Re: Session time out on HPUX machine

the time out is determined by the shell your using. for ksh and sh-posix the time out is defined by the enviornment variable TMOUT

If set to a value greater than zero, the shell will terminate if a command is not entered within the prescribed number of seconds after issuing the PS1 prompt. The default is zero, which means unlimited.

does a batch process every issue a prompt?
you can test that out.

of course you can always determine of the shell is interactive/batch and set TMOUT appropriately
Bill Hassell
Honored Contributor

Re: Session time out on HPUX machine

The shell is the primary interface between the user and Unix, but it is just a program. You can set TMOUT=3600 and the shell starts counting when you don't press a key. If an hour elapses, then the shell gives a warning and finally exits. However, if the user runs vi and then goes on a vacation, the shell is not running (it's waiting for vi) and therefore the session will never exit. (the variable autologout is used to set csh timeout)

Batch jobs do not login, they just run (ie, cron or bootup processes) so they are unaffected. By convention, batch jobs are not interactive so the timeout has no meaning.


Bill Hassell, sysadmin
Steven E. Protter
Exalted Contributor

Re: Session time out on HPUX machine

The variable TMOUT will do that.

Set it in /etc/profile

If the user is idle in an app like vi, it won't work.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ferdie Banu
Occasional Contributor

Re: Session time out on HPUX machine

Another one. If its an application that perform posting that runs for more than an hour will it be terminated by the session because it has no keyboard activity?
Jeroen Peereboom
Honored Contributor

Re: Session time out on HPUX machine

L.S.

Once my Oracle installation was aborted because ot the TMOUT variable. If the shell that started the (graphical) installation process times out, the children go down too.

I do not fully understand your last question, but:
- you can easily test it using a small TMOUT value?!
- If necessary you may want to use nohup.

JP.
Bill Hassell
Honored Contributor
Solution

Re: Session time out on HPUX machine

The shell controls what is terminated. If you start a process like Oracle, then the shell is no longer running, it is paused, waiting for Oracle to finish. Therefore, TMOUT will have no effect. On the other hand, if you start Oracle in the background as in:

$ oracle_prog some_params &
$

Then the oracle_prog is running in parallel to the shell. However, the shell is still the parent. So if the shell exits, then it's children are also terminated. If you try this:

$ sleep 100 &
[1] 23786
$ exit
There are running jobs.
$

So the shell is telling you that you still have subprocesses or children that will be terminated if the shell exits. If you type exit a second time, then the shell sends a hangup signal (kill -1) to all remaining child processes. If the child uses default handling of the kill -HUP (kill -1) signal then it terminates.

To protect a process that is started in the background from being terminated when the shell exits, nohup is used as a wrapper. It receives the signals and ignores them. Thus when the shell exits, nohup sees the SIGHUP and the protected process continues to run, but is now assigned to init as the new parent.


Bill Hassell, sysadmin