RE: How to get UNIX Process ID from within a running 4GL program
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
ps -ef | grep executable.4ge | awk 'BEGIN {FS=" "}{printf "%d\\n",$2} Bill Raper > -----Original Message----- > From: Tim Lim [SMTP:tim_lim@exe.com.au] > Sent: Wednesday, September 01, 1999 7:09 PM > To: informix-list@iiug.org > Subject: How to get UNIX Process ID from within a running 4GL program > > Hi there, > > > I have a need of get the UNIX process ID of my running 4GL program. > > Anyone has a known answer? > > Thanks > > > Tim LIm > >
William Raper <WilliamR@catmktg.com> wrote: > ps -ef | grep executable.4ge | awk 'BEGIN {FS=" "}{printf "%d\\n",$2} Not really a good idea. What happens when the user is running more instances of that application? (Not unusual, at least in my environment). Again: There are only 2 ways to get the PID of you application: 1) Use of getpid() in a C subroutine (IMHO *the* way this problem should be solved) 2) Use RUN "echo $PPID ...". (But that doesn't work on all shells, *don't* use this way, if you can avoid it.) Other suggenstions? Walter -- Walter Haslbeck <wh@sonic.ods.de> -- Walter Haslbeck <wh@sonic.ods.de> "Don't drink and root." (detlef.neubauer@gmx.de in <m3so7kmafq.fsf@voyager.neubauer.berlin.snafu.de>)