If you're running under Unix (Mac is Unix), then the ps -aef command will show running jobs. ON my Mac ...

UID PID PPID C STIME TTY TIME CMD 0 1 0 0 0:01.00 ?? 0:01.38 /sbin/launchd 0 11 1 0 0:00.82 ?? 0:01.04 /usr/libexec/kextd 0 12 1 0 0:07.11 ?? 0:13.22 /usr/sbin/Directory +Service 0 13 1 0 0:01.11 ?? 0:01.64 /usr/sbin/notifyd 0 14 1 0 0:00.73 ?? 0:01.57 /usr/sbin/syslogd ... 0 347 346 0 0:00.02 ttys000 0:00.03 login -pf tomdlux 503 348 347 0 0:00.11 ttys000 0:00.53 -bash 0 3935 348 0 0:00.00 ttys000 0:00.00 ps -aef

You can see that this 'ps' command had Process ID (PID) 3935, and Parent ID (PPID) 348 ... that's a bash shell which was launched by 'login'

use English '-no_match_vars'; will allow you to use $PID or $PROCESS_ID to see your process id, as will getpid(), described in perldoc perlfunc. The parent id is fetched by getppid(). If you're multi-threaded on Linux, you'll want Linux::PID.

If you're on Windows, you're welcome to switch to Unix.

As Occam said: Entia non sunt multiplicanda praeter necessitatem.


In reply to Re: Find name of calling script? by TomDLux
in thread Find name of calling script? by tel2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.