Enforcing session timeout under csh

Dieter Muller dieter at nmtsun.nmt.edu
Tue May 31 03:52:50 AEST 1988


In article <22987 at bu-cs.BU.EDU> madd at bu-it.bu.edu (Jim Frost) writes:
>In article <21319 at labrea.STANFORD.EDU> philf at 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 at nmtsun.nmt.edu



More information about the Comp.unix.wizards mailing list