Date: Wed, 23 Sep 1998 09:54:28 -0500 From: Dan Nelson <dnelson@emsphone.com> To: Andre Albsmeier <andre.albsmeier@mchp.siemens.de>, freebsd-questions@FreeBSD.ORG Subject: Re: How to get the PID before a program is run? (No joke :-) Message-ID: <19980923095428.B10645@emsphone.com> In-Reply-To: <199809230729.JAA12131@internal>; from "Andre Albsmeier" on Wed Sep 23 09:29:47 GMT 1998 References: <199809230729.JAA12131@internal>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Sep 23), Andre Albsmeier said: > I want to start a program but I need its PID before it is run. One > way would be to load the program and send a -STOP signal very > quickly. Then I have got the PID, can do some things and send a -CONT > signal when finished. uuh, you need to know the pid before you can send a -STOP to it :) Would a fork()/exec() pair do what you want? Just record the pid somewhere before you exec(). > I am sure there must be an esay way to do this on > FreeBSD but I didn't find any. My preferred way > of using it would be in a shell script but every > hint is welcome. How about: #! /bin/sh echo $$ > /var/run/program.pid exec /bin/program -Dan Nelson dnelson@emsphone.com 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?19980923095428.B10645>