Get my PID

W

Willem Kossen

Hi,
I need a way to get the process ID the script is running under from the
script itself and output it to a pidfile in /var/run. Anyone an idea how to
do this.

Thanks
 
G

Gunter Schelfhout

Willem said:
Hi,
I need a way to get the process ID the script is running under from the
script itself and output it to a pidfile in /var/run. Anyone an idea how
to do this.

Use the variable $$
 
G

Gregory Toomey

Willem Kossen said:
Hi,
I need a way to get the process ID the script is running under from the
script itself and output it to a pidfile in /var/run. Anyone an idea how to
do this.

Use $$ . From http://www.rexswain.com/perl5.html
"$$ The process ID of the currently executing Perl program. Altered
(in the child process) by fork."

gtoomey
 
J

Jürgen Exner

Willem said:
I need a way to get the process ID the script is running under from
the script itself and output it to a pidfile in /var/run. Anyone an
idea how to do this.

"perldoc perlvar" and scroll down to
$PROCESS_ID
$$ The process number of the Perl running this script. [...]

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top