Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Better way to search in the process table?

by shmem (Chancellor)
on Mar 02, 2014 at 22:04 UTC ( #1076744=note: print w/replies, xml ) Need Help??

in reply to Better way to search in the process table?

Well, this...
# more stuff with this pid # more stuff with the parent # more stuff with the grandparent # more stuff with the great-grandparent
...looks like a something recursive... like... nature...

Seriously, without knowing the purpose of all this, it is difficult to tell the meaning of life.
Maybe "more stuff" is an anonymous sub which does pamper/feed/play with/kill or such? and is passed as an argument into the sub which deals with a process?
Is all that just for fun? Do we want to build a tree?

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^2: Better way to search in the process table?
by karlgoethebier (Monsignor) on Mar 03, 2014 at 09:17 UTC

    Hello shmem and thank you very much for answering.

    I'm sorry if my question was too imprecise. This issue has a serious background and is not just for fun. On a Pentaho server some java processes run forever, consume all memory, bring load average up to 500 and then kill the machine.

    This These processes are triggered by cron which triggers a shell script that triggers another shell script that triggers the java process.

    No one had any idea yet why the processes run amok.

    My task is: The processes have to be monitored. At least pids, time and cmndline have to be written to a logfile. A mail has to be send to the admin of the machine. If the cputime exeeds some value, the processes have to be killed. (N.B.: Nagios is not an option).

    "Do we want to build a tree?"

    Yes, we really should do that ;-)

    I think, the solution provided below by kcott at Re: Better way to search in the process table? does what i need and is much better than my example.

    Update: I tried to fix my Denglisch ;-)

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1076744]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2018-06-18 19:42 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (110 votes). Check out past polls.