Get my PID

Discussion in 'Perl Misc' started by Willem Kossen, Aug 7, 2003.

  1. 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
     
    Willem Kossen, Aug 7, 2003
    #1
    1. Advertising

  2. 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
     
    Gunter Schelfhout, Aug 7, 2003
    #2
    1. Advertising

  3. "Willem Kossen" <> wrote in message
    news:5mnYa.177514$...
    > 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
     
    Gregory Toomey, Aug 7, 2003
    #3
  4. "Gregory Toomey" <> 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

    >
    >
    >
     
    Willem Kossen, Aug 7, 2003
    #4
  5. 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
     
    Jürgen Exner, Aug 7, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ray5531
    Replies:
    8
    Views:
    867
    Ray5531
    Jun 22, 2005
  2. Joe Schmoe

    How to get PID of invoked COM object?

    Joe Schmoe, Nov 16, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    3,210
    Bruce Barker
    Nov 16, 2005
  3. Robert M. Gary

    Get PID w/o JNI

    Robert M. Gary, Mar 18, 2005, in forum: Java
    Replies:
    3
    Views:
    4,612
    Michiel Konstapel
    Mar 21, 2005
  4. walker

    how can get other process pid

    walker, Nov 24, 2003, in forum: C Programming
    Replies:
    0
    Views:
    324
    walker
    Nov 24, 2003
  5. walker

    how can get other process pid

    walker, Nov 24, 2003, in forum: C Programming
    Replies:
    0
    Views:
    292
    walker
    Nov 24, 2003
Loading...

Share This Page