zsh-workers
 help / color / mirror / code / Atom feed
* Re: kill and pid files
       [not found] <199706211508.LAA08120@kira.peak.org>
@ 1997-06-21 16:37 ` Zoltan Hidvegi
  1997-06-21 18:39   ` Timothy Luoma
  0 siblings, 1 reply; 4+ messages in thread
From: Zoltan Hidvegi @ 1997-06-21 16:37 UTC (permalink / raw)
  To: luomat; +Cc: Zsh hacking and development

Timothy J. Luoma wrote:
> 	Zoltan Hidvegi <hzoli@ny.frontiercomm.net> wrote in
[...]
> > Oh, this is a really overcomplicated solution for a simple problem.  How
> > about this:
> >
> > pid () {
> > local i
> > for i
> > do
> > ps acx | sed -n "s/ *\([0-9]*\) .* $i *\$/\1/p"
> > done
> > }
> 
> Yes but what if there is more than one process by that name?
> 
> I usually want to kill them all.  This just kills one of them, whereas my
> solution kills them all (that's what the 'tr' part is for).... however, it
[...]
> it also takes multiple arguments, in case you need to kill several things at once

Did you try my script? kill -TERM `pid foo bar baz` will kill all foo, bar,
baz named processes.  And of course it can be improved, since sed is not
necessary:

pid () {
    setopt localoptions extendedglob
    local i
    for i
    do
        echo "${(M)${(M)${(f)$(ps acx)}:%* $i #}## #<->}"
    done
}

-- End of PGP signed section, PGP failed!

Where can I find your PGP key?  I tried finger -l, your web page and the
key servers with no luck.

Zoltan


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

* Re: kill and pid files
  1997-06-21 16:37 ` kill and pid files Zoltan Hidvegi
@ 1997-06-21 18:39   ` Timothy Luoma
  1997-06-21 18:46     ` Zoltan Hidvegi
  0 siblings, 1 reply; 4+ messages in thread
From: Timothy Luoma @ 1997-06-21 18:39 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: Zsh hacking and development




On Sat, 21 Jun 1997, Zoltan Hidvegi wrote:

> 
> Did you try my script? kill -TERM `pid foo bar baz` will kill all foo, bar,
> baz named processes.  And of course it can be improved, since sed is not
> necessary:
> 
> pid () {
>     setopt localoptions extendedglob
>     local i
>     for i
>     do
>         echo "${(M)${(M)${(f)$(ps acx)}:%* $i #}## #<->}"
>     done
> }


Yes but what if there are TWO processes running with the name 'foo'?

I want to be able to kill them both with one

kill -9 `pid foo`

But this may be a different in what we are calling using 'ps' 

TjL



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

* Re: kill and pid files
  1997-06-21 18:39   ` Timothy Luoma
@ 1997-06-21 18:46     ` Zoltan Hidvegi
  1997-06-22  4:06       ` Geoff Wing
  0 siblings, 1 reply; 4+ messages in thread
From: Zoltan Hidvegi @ 1997-06-21 18:46 UTC (permalink / raw)
  To: luomat; +Cc: Zsh hacking and development

> > pid () {
> >     setopt localoptions extendedglob
> >     local i
> >     for i
> >     do
> >         echo "${(M)${(M)${(f)$(ps acx)}:%* $i #}## #<->}"
> >     done
> > }
> 
> 
> Yes but what if there are TWO processes running with the name 'foo'?

The above function should find all processes called foo.  It should work
on all systems with BSD-style ps.

Zoltan


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

* Re: kill and pid files
  1997-06-21 18:46     ` Zoltan Hidvegi
@ 1997-06-22  4:06       ` Geoff Wing
  0 siblings, 0 replies; 4+ messages in thread
From: Geoff Wing @ 1997-06-22  4:06 UTC (permalink / raw)
  To: zsh-workers

On 22 Jun 1997 04:49:10 +1000, Zoltan Hidvegi <hzoli@ny.frontiercomm.net> wrote:
:> > pid () {
:> >     setopt localoptions extendedglob
:> >     local i
:> >     for i
:> >     do
:> >         echo "${(M)${(M)${(f)$(ps acx)}:%* $i #}## #<->}"
:> >     done
:> > }
:> Yes but what if there are TWO processes running with the name 'foo'?

And what if they're shell scripts?  And what if this has nothing to do with
zsh.workers and should at most be in zsh.users?
-- 
Geoff Wing [mason@primenet.com.au]   Technical Manager
  Phone    : +61-3-9818 2977         PrimeNet - Internet Consultancy
  Facsimile: +61-3-9819 3788         Web : <URL:http://www.primenet.com.au/>
  Mobile   : 0412 162 441


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

end of thread, other threads:[~1997-06-22  4:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199706211508.LAA08120@kira.peak.org>
1997-06-21 16:37 ` kill and pid files Zoltan Hidvegi
1997-06-21 18:39   ` Timothy Luoma
1997-06-21 18:46     ` Zoltan Hidvegi
1997-06-22  4:06       ` Geoff Wing

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).