From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,f38af7259640f04 X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-03-22 16:13:48 PST Path: gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!udel!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!torn!news.unb.ca!coranto.ucs.mun.ca!tony From: tony@engr.mun.ca (Tony Galway) Newsgroups: comp.unix.osf.osf1 Subject: Re: Killing processes on hangup Date: 23 Mar 1994 00:13:48 GMT Organization: C-CAE, Memorial University of Newfoundland Message-ID: <2mo1js$rmt@coranto.ucs.mun.ca> References: <2m9kdv$ald@email.tuwien.ac.at> <2mgiho$j7a@irz401.inf.tu-dresden.de> <2mlaac$60j@coranto.ucs.mun.ca> Reply-To: tony@engr.mun.ca NNTP-Posting-Host: borg.engr.mun.ca X-Newsreader: NN version 6.5.0 #14 (NOV) 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 | |