[comp.unix.questions] .suffile/.logout in ksh

ccs013@castor.ucdavis.edu (Jason Gabler) (05/25/89)

Does anyone know how to get a ".suffile" file to work for ksh?


Jason Gabler  ccs013@castor.ucdavis.edu   jygabler@ucdavis

benji@hpfcdq.HP.COM (Jeff Benjamin) (05/26/89)

> Does anyone know how to get a ".suffile" file to work for ksh?

I assume you mean the equivalent of csh .logout, to do something
when you exit a session?

Ksh does not do anything like this for you automatically; you have
to set up your .profile to trap the signal generated on a logout and
then execute a command.

Syntax for a ksh "trap" is: trap [arg] [sig]..., where "arg is a command
read and executed when the shell receives signal(s) sig."
See the ksh man page for more info.

The line to do this in my .profile looks like:

trap $HOME/.logout 0

This says "when you receive signal 0 (logout), execute $HOME/.logout".
So my .logout file is executed when I logout from ksh as well as
from csh.

-----
Jeff Benjamin                         {ucbvax,hplabs}!hpfcla!benji
Graphics Technology Division          benji%hpfcla@hplabs.HP.COM
Hewlett Packard Co.                   Fort Collins, Colorado	

tel@cbnewsh.ATT.COM (thomas.e.lowe) (05/29/89)

>trap $HOME/.logout 0
 
>This says "when you receive signal 0 (logout), execute $HOME/.logout".
>So my .logout file is executed when I logout from ksh as well as
>from csh.

KSH Has a timeout feature that will log you out after so many seconds
of idle time if your TIMEOUT (or TMOUT, i forget) is set.  I've been
told that doing this trap will prevent this timeout from working.
Is this true?  Why?  Bug or Feature?  Is it avoidable?

Thanks!
-- 
Tom Lowe    tel@hound.ATT.COM or  att!hound!tel     201-949-0428
AT&T Bell Laboratories, Room 2E-637A
Crawfords Corner Road,  Holmdel, NJ  07733
(R) UNIX is a registered trademark of AT&T  (keep them lawyers happy!!)

carroll@s.cs.uiuc.edu (05/31/89)

/* Written  8:21 pm  May 28, 1989 by tel@cbnewsh.ATT.COM in s.cs.uiuc.edu:comp.unix.questions */
/* ---------- "Re: .suffile/.logout in ksh  (affec" ---------- */
KSH Has a timeout feature that will log you out after so many seconds
of idle time if your TIMEOUT (or TMOUT, i forget) is set.  I've been
told that doing this trap will prevent this timeout from working.
/* End of text from s.cs.uiuc.edu:comp.unix.questions */
For ksh-i, that's not the case. I have TMOUT and trap "$HOME/.logout" EXIT
set, and they both work fine.

kamat@uceng.UC.EDU (Govind N. Kamat) (06/01/89)

In article <984@cbnewsh.ATT.COM> tel@cbnewsh.ATT.COM (thomas.e.lowe) writes:

>KSH Has a timeout feature that will log you out after so many seconds
>of idle time if your TIMEOUT (or TMOUT, i forget) is set.  I've been
>told that doing this trap will prevent this timeout from working.
>Is this true?  Why?  Bug or Feature?  Is it avoidable?

No, that is not true; the shell exits after TMOUT seconds of idle time
(+60 sec grace), and the trap is taken correctly when it exits.

-- 
Govind N. Kamat				College of Engineering
kamat@uceng.UC.EDU			University of Cincinnati
					Cincinnati, OH 45221, USA

jdpeek@RODAN.ACS.SYR.EDU (Jerry Peek) (06/03/89)

In two articles, people have written things like:
+ >KSH Has a timeout feature that will log you out after so many seconds
+ >of idle time if your TIMEOUT (or TMOUT, i forget) is set.  I've been
+ >told that doing this trap will prevent this timeout from working.
+ >Is this true?  Why?  Bug or Feature?  Is it avoidable?
+ 
+ No, that is not true; the shell exits after TMOUT seconds of idle time
+ (+60 sec grace), and the trap is taken correctly when it exits.

I had the problem with an old Korn Shell (before ksh-i) running under 4.3BSD
on a VAX 780.  It's been too long ago to remember.  But I think the shell
would either hang and not log out or give some error message without doing
the commands in the trap.  Sorry -- I can't remember more than that, and
I have ksh-i now.

--Jerry Peek; Syracuse University Academic Computing Services; Syracuse, NY
  jdpeek@rodan.acs.syr.edu, jdpeek@suvm.bitnet
  +1 315 443-3995