Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Get my PID (http://www.velocityreviews.com/forums/t881668-get-my-pid.html)

Willem Kossen 08-07-2003 07:38 AM

Get my PID
 
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

---------------------------------------------
Willem Kossen



Gunter Schelfhout 08-07-2003 07:50 AM

Re: Get my PID
 
Willem Kossen wrote:

> 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 $$
--
Blood, sweat & tears

Gregory Toomey 08-07-2003 07:51 AM

Re: Get my PID
 
"Willem Kossen" <wjk100@iname.com> wrote in message
news:5mnYa.177514$Fc6.14433590@amsnews02.chello.co m...
> 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





Willem Kossen 08-07-2003 09:08 AM

Re: Get my PID
 

"Gregory Toomey" <NOSPAM@bigpond.com> wrote in message
> > 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
>


thanks that's what i need

Willem

>
>
>




Jürgen Exner 08-07-2003 12:44 PM

Re: Get my PID
 
Willem Kossen wrote:
> 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




All times are GMT. The time now is 06:55 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.