Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: tony@engr.mun.ca (Tony Galway)
Subject: Re: Killing processes on hangup
Date: 23 Mar 1994 00:13:48 GMT	[thread overview]
Message-ID: <2mo1js$rmt@coranto.ucs.mun.ca> (raw)
In-Reply-To: 2mlaac$60j@coranto.ucs.mun.ca

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            | | 


      parent reply	other threads:[~1994-03-23  0:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]
read-only archive

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