Finding Process ID

From: Kazuro FURUKAWA <kazuro.furukawa_at_kek.jp>
Date: Tue, 23 Oct 2001 05:56:39 +0900

Hi managers,

If I want to find a process whose command is "/xxx/abc"
distinguishing from "/yyy/abc", I may type
  ps -o pid,command | grep "/xxx/abc"

However, sometimes it fails because
  ps -o pid,command | grep abc
returns "[abc]" instead of "/xxx/abc".

What are better ways to deal with it?

Do I have to keep pid somewhere when a process starts as many
daemons do? Maybe it's the answer. But we already have many programs
which should be monitored, and I'd like to find some work-around.

I've looked in /sbin/init.d/bin/getpid, but it uses above method.
I think scripts in /sbin/init.d which use getpid with full paths
may fail easily.

-----
Kazuro FURUKAWA <kazuro.furukawa_at_kek.jp>
 Linac, High Energy Accelerator Research Organization (KEK), Japan
Received on Mon Oct 22 2001 - 20:57:37 NZDT

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