Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!hc!beta!unm-la!unmvax!nmtsun!dieter
From: dieter@nmtsun.nmt.edu (Dieter Muller)
Newsgroups: comp.unix.wizards
Subject: Re: Enforcing session timeout under csh
Message-ID: <285@nmtsun.nmt.edu>
Date: 30 May 88 17:52:50 GMT
References: <21319@labrea.STANFORD.EDU> <22987@bu-cs.BU.EDU>
Reply-To: dieter@titan.UUCP (Dieter Muller)
Organization: New Mexico Tech, Socorro NM
Lines: 35

In article <22987@bu-cs.BU.EDU> madd@bu-it.bu.edu (Jim Frost) writes:
>In article <21319@labrea.STANFORD.EDU> philf@med-isg.stanford.edu (Phil Fernandez) writes:
>|One of my users with a Sun 3/60 wishes to enforce an idle session
>|timeout under SunOS 3.5.
>
>This is actually quite generic and could time out just about anything.
>
[ program that sleeps then kill (cshpid, SIGHUP) ]

There's only one minor little problem with this.  If the user is running
some big hairy huge job that'll run for 5 hours and also changes its
process group, that job doesn't get killed.  In fact, you now are the
proud owner of a process that will randomly splat all over the next
user's terminal.  If the BHHJ also reads, you've got some real problems.

I've been playing with this sort of problem off and on for a while now,
and I can't see any nice way of dealing with it.  Our problem is more
along the lines of restricting certain types of accounts to certain hours,
but the basic principle remains.

The only guaranteed solution I've found is something that, when the time
to nuke arrives, effectively does something along the lines of:

set gleep = `ps x | egrep $WHATEVER | egrep -v egrep | colrm 6`
kill -9 $gleep
unset gleep

(csh & 4.2BSD syntax, if it matters), where WHATEVER is set to the
appropriate criterion (user name, terminal, etc.)

Dieter
-- 
You want coherency, cogency, and literacy all in one note?  Be real.
...{cmcl2, ihnp4}!lanl!unm-la!unmvax!nmtsun!dieter
dieter@nmtsun.nmt.edu