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

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 (Prior) 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
Node Status?
node history
Node Type: note [id://1076744]
help
Chatterbox?
[thezip]: Our cat is single-handedly (pawed-ly?) solving our field mouse problem. About four critters in the last week alone.
[thezip]: Amazing speed and stealth in that one.
[GotToBTru]: You can't tunafish, but some seafood companies can tunafish. More fun with English.
[virtualsue]: a veterinarian told me to cut down on my cat's food. i said, when i do that she just catches more mice
[thezip]: My dogs are also excellent mousers, at least that's what they tell me.
[GotToBTru]: our beagle has dispatched 3 rabbits to the Great Hutch in the Sky since March.
[thezip]: I can always tell when the dogs have been mousing, as there is a concentric ring of mud around the end of their snouts when they do.
[thezip]: As for more physical evidence, that always seems to be missing somehow

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (16)
As of 2017-11-17 19:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (272 votes). Check out past polls.

    Notices?