killing idle processes
King Ables
ables at mcc-db.UUCP
Thu Apr 18 04:29:28 AEST 1985
[Exterminate, exterminate, exterminate...
Come along, R2, I don't think they like us.]
Well, as promised (and as so few people do) here is a summary
of what I found out from people's replys to my query about killing
off idle jobs. As it happens, the problem solved itself, but I
am still grateful for those who replied and I intend to keep the
information around in case I need it sometime in the future.
Most people either had made a kernel hack or had a short shell
script that did an effective although perhaps not very clean
(either they could be fooled by an expert, or could make
a mistake in certain situations) kill on idle users.
The suggestions for coming up with a method from scratch
centered around:
1) hacking w or ps (which some people had done)
2) using last mod time of /dev/tty?? as a basis for "idleness,"
then all you have to do is send a HUP signal (SIGHUP) to the
process you want to kill (some said also send a SIGCONT).
3) use the csh 'autologout' feature (honor system)
People who had (and sent me) a program or a set of programs are
listed below. If people think any of these programs should be
posted to net.sources, please contact the originator of the reply
(listed below), not me. I don't think it's my place to post
someone else's code, and this way, we won't chance multiple
postings. If, for some reason, the originator asks me to post it,
I certainly will be glad to.
Raleigh Romine (seismo!romine)
reaper package (programs, makefile, man pages, etc.)
All files total about 18000 characters.
Jim Knutson (ut-sally!ut-ngp!knutson)
killidle.c program - 3944 characters
Andrew M. Rudoff (seismo!hao!nbires!boulder!andy)
hup, tout programs
tout is a timeout program a user can execute from
within .login (honor system) - 1963 characters
hup is an easy hangup program (so you don't have
to look up his PID) - 1323 characters
Jim Palmer (nbires!utopia!palmer)
jaws package (program and 6 awk scripts) - total of
about 1500 characters
Rick Auricchio (seismo!nsc!cadtec!rick) has a program called gr.c
(grim reaper) which he did not send, but said he might want to post
if there is enough interest.
The following are comments that I felt warranted exposure for some
reason:
Bjorn Eriksen (seismo!mcvax!enea!ber)
> I have a modified version of 'ps' called 'idle' that is run from
> crontab and loggs people off after a specified time (given as an
> option to idle). It checks if people have only the login-shell
> running. If they have other jobs they won't be logged out. It also
> checks a list of "trusted users" that shouldn't be killed.
> It's for 4.2BSD.
Doug Gwyn (gwyn at BRL-TGR.ARPA)
> There is NO way of knowing whether a user is really asleep or not.
> Some of our 5620 DMD users make no demands on the host for hours,
> but they DO need the line left open.
Dick Dramstad (rad at Mitre-Bedford.ARPA)
> We're using a modified csh here which has as one of its added
> features an "autologout" setting. The "newcsh" was done by Ken Greer
> (?lately? of HP Labs), and includes Tenex-style command and filename
> completion, history saving across login sessions, and an idle-time
> autologout.
>
> His implementation allows the user to set the idle time length or
> unset it completely (it's just a shell variable that's used), but you
> could make it mandatory if you wanted. It only works when the user is
> idle at the shell command level, not when they're idle in some other
> program, such as an editor, but we've noticed that when users walk
> away from their terminal they're usually at the shell level anyway.
>
> Implementation is (almost) trivial; add an alarm(60*idlelimit)
> call in the csh after a command completion, an alarm(0) call just
> before the fork for a command exec, and set up an interrupt handling
> routine for the alarm signal which would do the usual logout stuff.
Also thanks to others who replied whose comments were genericly included:
seismo!noao!terak!asuvax!mot!fred
Dave Harrison (ihnp4!utcs!utfyzx!harrison)
Richard G. Bubenik (seismo!wucs!rick)
Dan Messinger (ihnp4!umn-cs!digi-g!dan)
Greg Woods (nbires!hao!woods)
------
-King
ARPA: ables at mcc
UUCP: {ihnp4,seismo,ctvax}!ut-sally!mcc-db!ables
More information about the Comp.unix
mailing list