Re: How to get UNIX Process ID from within a running 4GL program
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
From: "Tim Lim" <tim_lim@exe.com.au>
>
>I have a need of get the UNIX process ID of my running 4GL program.
>
>Anyone has a known answer?
It's ugly, but:
CREATE TEMP TABLE x (pidno int)RUN "echo $$ > /tmp/someuniquename"
LOAD FROM /tmp/someuniquename INSERT INTO temptable
and there you go.
HTH.
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
Obnoxio The Clown <obnoxio@hotmail.com> wrote:
>>I have a need of get the UNIX process ID of my running 4GL program.
> CREATE TEMP TABLE x (pidno int)> RUN "echo $$ > /tmp/someuniquename"
> LOAD FROM /tmp/someuniquename INSERT INTO temptable
With this construction you don't get the PID of the *4gl* program, but
the PID of the shell that is executing the RUN command.
If you really want the PID of the 4gl program, you have to use the
C-wrapper-getpid()-version mentioned also in this thread. Or, in bash
or ksh (don't know if it works in a "normal" /bin/sh) use echo $PPID
to get the PID of the parent (in this case the 4gl-Program) process.
Walter
--
Walter Haslbeck <wh@sonic.ods.de>
"Don't drink and root."
(detlef.neubauer@gmx.de in <m3so7kmafq.fsf@voyager.neubauer.berlin.snafu.de>)