Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Killing processes on hangup
@ 1994-03-17 13:02 Martin J. Laubach
  1994-03-20  4:13 ` Hans-Peter Stoerr
  0 siblings, 1 reply; 5+ messages in thread
From: Martin J. Laubach @ 1994-03-17 13:02 UTC (permalink / raw)


  I'm using one of the alphas here as server for incoming telnet
connections from all over campus. The problem is that many users
don't seem to correctly terminate their processes, and they
continue to run, accumulating ridiculous amounts of memory and
processor time (ever seen a tin with 95% CPU?)...

  Is there a way to automatically kill all processes left behind
on logout?

	mjl



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Killing processes on hangup
  1994-03-17 13:02 Killing processes on hangup Martin J. Laubach
@ 1994-03-20  4:13 ` Hans-Peter Stoerr
  1994-03-21 23:23   ` Tony Galway
  0 siblings, 1 reply; 5+ messages in thread
From: Hans-Peter Stoerr @ 1994-03-20  4:13 UTC (permalink / raw)


In article <2m9kdv$ald@email.tuwien.ac.at> mjl@tick.cslab.tuwien.ac.at (Martin J. Laubach) writes:

>   Is there a way to automatically kill all processes left behind
> on logout?

If Your users use csh or tcsh, you may put something like

kill `ps -x | tail +2 | gawk '{print $1}'`

in their standard .logout

Haps


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Killing processes on hangup
  1994-03-20  4:13 ` Hans-Peter Stoerr
@ 1994-03-21 23:23   ` Tony Galway
  1994-03-22 12:29     ` Kevin O'Brien
  1994-03-23  0:13     ` Tony Galway
  0 siblings, 2 replies; 5+ messages in thread
From: Tony Galway @ 1994-03-21 23:23 UTC (permalink / raw)


hs3@irz.inf.tu-dresden.de (Hans-Peter Stoerr) writes:

>>   Is there a way to automatically kill all processes left behind
>> on logout?

>If Your users use csh or tcsh, you may put something like
>kill `ps -x | tail +2 | gawk '{print $1}'`
>in their standard .logout


This unfortunately is not really a very good solution. We have the same
problem here, and looks like we are going to have to write a
program/script, something to take care of this. 

tin, nn, vi ... programs such as these should always have a terminal 
associated with it, however there are also programs that should be
run in the background. We have users placing massive abaqus, ansys,
matlab, and private programs in the background that should not be 
killed. 

You might consider creating a program/script that has a file that contains
those programs that should NOT be separated from their ttys, and grep
for those searching to see if ?? appears in the TT field, so for example,

ps aux | grep nn | awk '{if ($7 == "??") {print $2}}' | xargs kill -HUP
( or TERM or KILL <-- my favorite .. works all the time :) )

would search for all "nn" sessions and kill off those that have ?? in the
TT field.

This is a little unwieldy, but its probably easiest, if anyone has 
a better sugestion, I am all ears.

-Tony
--
Tony Galway                           Life is what happens while you're 
C-CAE                      |\_/|    making other plans.
Memorial University        (` ')
tony@engr.mun.ca            | | 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Killing processes on hangup
  1994-03-21 23:23   ` Tony Galway
@ 1994-03-22 12:29     ` Kevin O'Brien
  1994-03-23  0:13     ` Tony Galway
  1 sibling, 0 replies; 5+ messages in thread
From: Kevin O'Brien @ 1994-03-22 12:29 UTC (permalink / raw)


In article <2mlaac$60j@coranto.ucs.mun.ca> tony@engr.mun.ca writes:

[clipoid]
>You might consider creating a program/script that has a file that contains
>those programs that should NOT be separated from their ttys, and grep
>for those searching to see if ?? appears in the TT field, so for example,
>
>ps aux | grep nn | awk '{if ($7 == "??") {print $2}}' | xargs kill -HUP
>( or TERM or KILL <-- my favorite .. works all the time :) )

Mine looks like the following.  Not as elegant as yours but it works (sort of).

ps -ef |grep "??" |grep -v root |grep -v news |cut -c10-15 >  $HOME/.kill_PIDs
Then I just step through the file .kill_PIDs and "kill -9" everything I 
find.  The "grep -v"'s just keep the essentials from getting boinged!

The question still remains:  Why in #%$@#%@ do we have to do this stuff 
anyway?  Where is the parameter that we set that will cause OSF to deal 
with orphans the way (most?) other UNIX's do?  I'm far too busy to hack.  
An if I wasn't too busy, I'd be running Linux, cheap and hacker heaven!

-- 
+---------------------------------------------------------------------------+
| Kevin O'Brien | Network Analyst PEINet | obrien@peinet.pe.ca | This space |
| P.O. Box 3126 | Charlottetown P. E. I. |   Canada, C1A- 7N9  | for  rent. |
+---------------------------------------------------------------------------+


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Killing processes on hangup
  1994-03-21 23:23   ` Tony Galway
  1994-03-22 12:29     ` Kevin O'Brien
@ 1994-03-23  0:13     ` Tony Galway
  1 sibling, 0 replies; 5+ messages in thread
From: Tony Galway @ 1994-03-23  0:13 UTC (permalink / raw)


tony@engr.mun.ca ( I ) write:

>ps aux | grep nn | awk '{if ($7 == "??") {print $2}}' | xargs kill -HUP
>( or TERM or KILL <-- my favorite .. works all the time :) )

Actually as soon as I posted this, I realized a small change and this 
becomes an easy script that can be half useful ... use fgrep and a file
of processes that should have a terminal associated.

So now we have

ps aux | fgrep -f badjobs | awk '{if ($7 == "??") {print $2}}' | xargs kill -HUP

and we will need a file called badjobs that will list those programs that
should have a term associated with it ...
nn
vi
pine
elm
etc.

-Tony

PS. Still wondering if anyone has a nicer way of doing it ... looks like
I am going to be doing it this way for a bit, but I will need to expand
it to check the amount of CPU time used by the process. For instance, it
is possible to have an ftp session with a disassociated terminal, but 
also sometimes these spin out of control, so I will probably add something
to put a cap on cpu time used. 
--
Tony Galway                           Life is what happens while you're 
C-CAE                      |\_/|    making other plans.
Memorial University        (` ')
tony@engr.mun.ca            | | 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1994-03-23  0:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-03-17 13:02 Killing processes on hangup Martin J. Laubach
1994-03-20  4:13 ` Hans-Peter Stoerr
1994-03-21 23:23   ` Tony Galway
1994-03-22 12:29     ` Kevin O'Brien
1994-03-23  0:13     ` Tony Galway

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox