Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Feb 2001 20:56:28 -0500 (EST)
From:      Felix-Antoine Paradis <reel@sympatico.ca>
To:        "Christopher W. Aiken" <cwaiken@telerama.com>
Cc:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Shell Question
Message-ID:  <Pine.BSF.4.31.0102152055300.19699-100000@idemnia.ath.cx>
In-Reply-To: <Pine.BSF.4.33.0102152040050.562-100000@bigdaddy.localdomain>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> How do I get the pid of the job I'm placing in the bg?
>
> The script is:   mystuff {start|stop}
> In mystuff I bg a job by:   my_script &
>
> How do I get the PID of my_script so that I can use
> it to kill the job when I:  mystuff stop
>
> I'm looking for something like:  PID=my_script &

Use:

PID_MY="`ps -U $USER |grep my_script |awk '{ print $1 }'`"

It will do the job

______________________
Felix-Antoine Paradis
reel@sympatico.ca
PGP Key ID: 0x7B3AD2C5

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8

iQA/AwUBOoyI1DBxB4d7OtLFEQJhEwCfcMMI6d6r0mEksSqHS5VtjLTftWcAnik8
8PalpetHpk1Q/sLMjE5SuL7c
=Bf9n
-----END PGP SIGNATURE-----




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?Pine.BSF.4.31.0102152055300.19699-100000>