From owner-freebsd-questions Wed Sep 23 10:59:40 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA11633 for freebsd-questions-outgoing; Wed, 23 Sep 1998 10:59:40 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA11574 for ; Wed, 23 Sep 1998 10:59:18 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.1/8.9.1) id MAA26835; Wed, 23 Sep 1998 12:57:49 -0500 (CDT) Date: Wed, 23 Sep 1998 12:57:49 -0500 From: Dan Nelson To: Studded Cc: Andre Albsmeier , freebsd-questions@FreeBSD.ORG Subject: Re: How to get the PID before a program is run? (No joke :-) Message-ID: <19980923125749.A26376@emsphone.com> References: <199809230729.JAA12131@internal> <19980923095428.B10645@emsphone.com> <360931B1.29E98E12@dal.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.94.3i In-Reply-To: <360931B1.29E98E12@dal.net>; from "Studded" on Wed Sep 23 10:36:49 GMT 1998 X-OS: FreeBSD 2.2.7-STABLE Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Sep 23), Studded said: > Dan Nelson wrote: > > > How about: > > > > #! /bin/sh > > echo $$ > /var/run/program.pid > > $$ is the pid of the shell. > > Doug You left out the rest of my script :) #! /bin/sh echo $$ > /var/run/program.pid exec /bin/program The exec replaces the shellscript with the program. The pid does not change. I did test the script before posting the message ya know :) -Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message