Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Sep 1998 19:43:33 +0200 (CEST)
From:      Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
To:        Studded@dal.net (Studded)
Cc:        dnelson@emsphone.com, 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:  <199809231743.TAA03306@internal>
In-Reply-To: <360931B1.29E98E12@dal.net> from Studded at "Sep 23, 98 10:36:49 am"

next in thread | previous in thread | raw e-mail | index | archive | help
> Dan Nelson wrote:
> 
> > How about:
> > 
> > #! /bin/sh
> > echo $$ > /var/run/program.pid
> 
> 	$$ is the pid of the shell. 

NoNo, I want the PID of the program I will start from
the shell. It can be done with two shell scripts:
No. 2 is run by No. 1 and exec's my program when
No. 1 has finished doing it's stuff with the PID
of No. 2. When my program finishes, No. 1 can
remove the stuff it has done and exits.

However, I am just writing a small C program which does
this (by fork()) since this easier than havin two
shell scripts talking with each other.

	-Andre

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?199809231743.TAA03306>