Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 May 2000 00:58:31 +0200
From:      "Olivier Cortes (ML)" <receiver@deep-ocean.net>
To:        "Alex Boisvert" <boisvert@exoffice.com>, "FreeBSD Questions" <freebsd-questions@FreeBSD.org>
Subject:   RE: PID of a forked process
Message-ID:  <EJEFLAEIHOBBKCGOKMJJMEFFCDAA.receiver@deep-ocean.net>
In-Reply-To: <39206FEF.226AE171@exoffice.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?EJEFLAEIHOBBKCGOKMJJMEFFCDAA.receiver>