From owner-freebsd-questions Mon May 15 16: 0:54 2000 Delivered-To: freebsd-questions@freebsd.org Received: from syrenna.deep-ocean.net (ca-ol-bordeaux-7-4.abo.wanadoo.fr [62.161.110.4]) by hub.freebsd.org (Postfix) with ESMTP id 813F437B581 for ; Mon, 15 May 2000 16:00:45 -0700 (PDT) (envelope-from receiver@deep-ocean.net) Received: from pozeidon (pozeidon.deep-ocean.net [192.168.0.12]) by syrenna.deep-ocean.net (8.9.3/8.9.3) with SMTP id AAA68628; Tue, 16 May 2000 00:56:31 +0200 (CEST) (envelope-from receiver@deep-ocean.net) From: "Olivier Cortes (ML)" To: "Alex Boisvert" , "FreeBSD Questions" Subject: RE: PID of a forked process Date: Tue, 16 May 2000 00:58:31 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2776.0) In-Reply-To: <39206FEF.226AE171@exoffice.com> X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Importance: Normal Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG you can also try "pidof my_process" in a script, there is a little more complex: ps ax | grep "my_process" | cut -c1-6=20 bye=20 olive -----Message d'origine----- De : owner-freebsd-questions@FreeBSD.ORG [mailto:owner-freebsd-questions@FreeBSD.ORG]De la part de Alex Boisvert Envoy=E9 : lundi 15 mai 2000 23:45 =C0 : freebsd-questions@freebsd.org Objet : PID of a forked process Hello, I have a basic BASH-related question. How does one obtain the PID of a forked process in bash? Here's what I'd like to do: #!/usr/local/bin/bash while test 1 do PID =3D some_long_process & sleep 60 kill -9 PID done I'm going to use this script in a test framework where I need to test an application for recoverability. So I want to start the application, wait for a given amount of time and then kill this application and repeat. So how to I obtain the PID of a process which is forked? I've tried %% but it didn't work. regards, alex. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message