Re: speaking of SysV scripts - kill

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Mike Garfias
Date:  
To: plug-discuss
Subject: Re: speaking of SysV scripts - kill
Why not: ps aux | grep relaydelay | awk '{print $2}' | xargs kill -15

seems simpler to type

Bill Warner spoke forth with the blessed manuscript:
> Something I use a lot instead of cut is awk '{ print $x }' where $x is
> the column from the left. your ps command would look something like:
>
> ps aux |grep relaydelay |awk '{ print $2 }' |xargs -n /bin/kill -15
>
> to do it in a for loop
>
> for each in `ps aux |grep relaydelay |awk '{ print $2 }'`; do
> /bin/kill -15 $each
> done
>
> for each (temp shell variable) in `<command>` (pipe output of a command
> into the for loop and iterate each item through the $each variable); do
> /bin/kill -15 $each (kill each instance of your command output)
> done
>
> Just some of the things I do almost daily. Not necessarily to kill a
> process pkill is better for that, but find, creating and moving files is
> made easier by this. As you learn the command line it really is a great
> tool.
>
>
>
> On Tue, 2005-01-25 at 10:35 -0700, Craig White wrote:
> > On Tue, 2005-01-25 at 10:14 -0700, Kevin wrote:
> > > On Tue, 2005-01-25 at 10:07 -0700, Craig White wrote:
> > > > On Mon, 2005-01-24 at 20:13 -0700, Craig White wrote:
> > > > if I want to kill a running process, I need to find it and kill it.
> > > >
> > > > /bin/ps aux|grep relaydelay|cut -c9-14|/usr/bin/xargs -n 1 /bin/kill -15
> > > >
> > > > seems to work for locating a process in ps and sending it a kill -15
> > > >
> > > > Is there a better way?
> > >
> > > How about `pkill -15 relaydelay`?
> > >
> > ----
> > ::::blush::::
> >
> > that was too simple !
> >
> > gosh am I dumb...I couldn't get it die with kill arguments
> > because /usr/bin/perl is the app - pkill (file in memory banks).
> >
> > Thanks - there goes the first command I did using both cut & xargs
> > either individually or separately by myself - without plug support.
> >
> > Craig
> >
> > ---------------------------------------------------
> > PLUG-discuss mailing list -
> > To subscribe, unsubscribe, or to change you mail settings:
> > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> --
> Bill Warner <>
>
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss