From owner-freebsd-questions Mon May 15 16: 6: 6 2000 Delivered-To: freebsd-questions@freebsd.org Received: from livid.webhosting.com (ppp208.webhosting.com [207.236.70.208]) by hub.freebsd.org (Postfix) with ESMTP id 4BB1437B91A for ; Mon, 15 May 2000 16:06:00 -0700 (PDT) (envelope-from freebsd@webhosting.com) Received: from localhost (freebsd@localhost) by livid.webhosting.com (8.9.3/8.9.3) with ESMTP id TAA28865; Mon, 15 May 2000 19:12:05 -0400 (EDT) X-Authentication-Warning: livid.webhosting.com: freebsd owned process doing -bs Date: Mon, 15 May 2000 19:12:04 -0400 (EDT) From: Nicolas Perreten To: "Olivier Cortes (ML)" Cc: Alex Boisvert , FreeBSD Questions Subject: RE: PID of a forked process In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Nicolas Perreten Sr. Administrator, Webhosting.com Inc, Member in good standing of PETA, People Eating Tasty Animals On Tue, 16 May 2000, Olivier Cortes (ML) wrote: > you can also try "pidof my_process" > > in a script, there is a little more complex: > > ps ax | grep "my_process" | cut -c1-6 With the above, you risk reading the PID of the grep process.. ps ax | grep "my_process" | grep -v grep | cut -c1-6 is a better bet. -nick Nicolas Perreten Sr. Administrator, Webhosting.com Inc, Member in good standing of PETA, People Eating Tasty Animals To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message