[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT Shell tricks: I'll kill you later



"Karsten M. Self" <kmself@ix.netcom.com> writes:

> I have few ugly shell scripts which do a lot of WHOIS queries, which
> I've found are prone to hang for a long time.  The simple thing to do is
> to hunt for whois queries, then, and periodically kill them:
>
>     while sleep 600
>     do
>         ps aux | awk '/[w]hois/ {print $2}' | xargs kill
>     done
>
> Of course, this is a bit indiscriminate:  it kills any WHOIS process
> that happens to be running at the moment.

Not only that; it kills any process which has "whois" in its command
line.  You might want to look into pidof and/or killall.

Martin


-- 
   ,--.    Martin Dickopp, Dresden, Germany                 ,= ,-_-. =.
  / ,- )   http://www.zero-based.org/                      ((_/)o o(\_))
  \ `-'                                                     `-'(. .)`-'
   `-.     Debian, a variant of the GNU operating system.       \_/



Reply to: