http://www.perlmonks.org?node_id=647154

monkfan has asked for the wisdom of the Perl Monks concerning the following question:

Dear experts,

Since some of the process spawned by particular user/pid takes too long time to run. I have this particular task I want to achieve with Perl:

  1. Get PID and running time info of a particular Username
  2. Check how long is the running time.
  3. Kill that process if it exceed a pre-defined threshold.

I intend to do a cron job for this Perl script.

Is there any simple way to do that with Perl? My main concern is No.1 and 2. Is there any CPAN module that get that information? For killing a process, maybe I can just use Perl's 'system' command.

Regards,
Edward