Digimon Digitizer 2 Digimon Digitizer 2 - 6 months ago 12
Perl Question

PERL: How to know how my script is being executed? (Manual/System like cron/other scripts)

My question now is mentioned at the title:
How to know how my script is being executed? (Manual/System like cron/other scripts)?

I wish you guys could help me. I have this long issue trying to know how a script is being executed and by who.

Answer

You can get the parent PID with getppid.

Then finding the parent process name from its PID is non-portable. On linux/unix you could run the ps command and parse the output. On Windows you'll probably need something like Win32::Process::List. No idea for OSX or other operating systems, try Googling perl get process name from pid.

Comments