Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Better way to search in the process table?

by shmem (Chancellor)
on Mar 02, 2014 at 22:04 UTC ( [id://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 (Abbot) 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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1076744]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-25 14:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found