On 10/18/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

On Wed, Oct 18, 2006 at 02:06:34PM -0700, Carl Lowenstein wrote:
> Basic idea is to use some restrictive options on ps(1) so it only
> gives you the PID and the comand with arguments, then select the PID
> column of the pertinent line.  Use this output as input to the kill
> command of your choice.  e.g.
>
> $ kill -HUP $( ps -eo pid,cmd | gawk '/start.py/{print $1; exit}' )

This seems to work...

kill `ps -ef | grep "python2.4 start.py" | grep seb | cut -f 7 --delimiter=" "`


You are asking ps to put out a whole line of stuff, most of which you
don't need.  Then you are rejecting the un-needed stuff with a couple
of calls to grep, and then cut.  Much neater to have ps put out only
the two fields you need,  Or perhaps 3 fields, if it is really
necessary to select for user "seb".

Why use grep, grep, and cut when a single call to gawk will do it.
Is the argument "start.py" associated with anything other than the
program "python2.4"?
Is anyone other than "seb" running "start.py"?

   carl
--
   carl lowenstein         marine physical lab     u.c. san diego
                                                [EMAIL PROTECTED]


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to