Shell strangeness and kill by name

From: Burch Seymour RTPS <bseymour_at_ns.encore.com>
Date: Thu, 23 Jul 1998 13:40:57 -0400 (EDT)

Perhaps there's a better way to do this, but I thought I had developed
an answer, even if a bit crude. The problem: I'm moving and app to
DU which used to run on an OS that dealt very well with processes by name.
So, I need a way to kill processes by name. If there is an interface that
does that, I'm missing it (suggestions appreciated).

So, I came up with a ps and grep solution, but it acts strangely, working
one day and not the next and I'm not seeing the problem. For example:

   get all processes, grep for the one I want, minus the grep proc and
   cut only the pid. This would be enclosed in a kill `<cmd>` thing
   to actually do the deed. However, it returns nothing!

pacer> ps -ef | grep csci2_t2 | grep -v grep | cut -f 3 -d ' '

pacer>

   Now if I run just the ps and grep parts I see there *is* a
   process out there:

pacer> ps -ef | grep csci2_t2 | grep -v grep
bseymour 13014 1 0.6 13:27:19 ttyp1 0:00.14 [csci2_t2]

   And, if I take the output from the ps and greps and run it through
   the cut command, I get the parent process ID.

pacer> echo bseymour 13014 1 0.6 13:27:19 | cut -f 3 -d ' '
1
pacer>

I'm baffled as to why doing this as two commands works, but as one
does not. Do any of you see what it is that I am missing?

And again, is there a better way to kill processes by name?

Mucho thanxo.

-- 
This message from,		Encore Computer Corporation   MS/108
Burch Seymour                   6901 W Sunrise Boulevard
Senior Software Engineer	Fort Lauderdale, Fl 33313 
email: bseymour_at_encore.com      Vox: (954)316-4480   Fax: (954)316-4454
Received on Thu Jul 23 1998 - 17:38:18 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:38 NZDT