From owner-freebsd-questions Wed Sep 23 06:52:06 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id GAA27572 for freebsd-questions-outgoing; Wed, 23 Sep 1998 06:52:06 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from pobox.com (lafra-119.mdm.mkt.execpc.com [169.207.80.247]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id GAA27567 for ; Wed, 23 Sep 1998 06:52:03 -0700 (PDT) (envelope-from hamilton@pobox.com) Message-Id: <199809231352.GAA27567@hub.freebsd.org> Received: (qmail 11122 invoked from network); 23 Sep 1998 08:55:56 -0500 Received: from localhost (HELO pobox.com) (127.0.0.1) by localhost with SMTP; 23 Sep 1998 08:55:56 -0500 To: Andre Albsmeier cc: freebsd-questions@FreeBSD.ORG Subject: Re: How to get the PID before a program is run? (No joke :-) In-reply-to: Your message of "Wed, 23 Sep 1998 09:29:47 +0200." <199809230729.JAA12131@internal> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 23 Sep 1998 08:55:55 -0500 From: Jon Hamilton Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <199809230729.JAA12131@internal>, Andre Albsmeier wrote: } Hi, } } I have a rather curious problem here: } } 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. It's actually fairly simple, though somewhat off the beaten path. Something like: #!/bin/sh echo "PID is $$" exec /your/program/here and you're in business. -- Jon Hamilton hamilton@pobox.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message