Killing straggling processes
Just a general question for the unix readers out there... Can anyone think of an easy way to effectively kill straggling processes? For some of our automated builds, we use a system to distribute to remote agents. Some of that work involves starting up Geronimo, and other servers. Sometimes those servers don't stop properly, which messes up future execution of jobs sent to that agent. I'm trying to figure out a simple way, to allow those future executions to have a better chance of success by making sure there are no straggling processes left behind. Idea is also to just kill the children processes of the agent, but not anything else (like a su, or ssh for that user). Any sh-hackers out there know how to just get the list of a processes children (and children's children)... list as pids of course, so I can kill -9 them. My brain is fried... can't think of an easy way to do this... if anyone knows, please drop some knowledge :-) Thanks, --jason
Re: Killing straggling processes
I did not write this and have no clue how it works :) We faced a similar situation in gump: http://issues.apache.org/jira/browse/GUMP-35 Leo Simons wrote this piece of code: http://svn.apache.org/viewvc/gump/branches/Gump3/pygump/python/gump/util/executor.py?view=markup thanks, dims On 2/15/07, Jason Dillon <[EMAIL PROTECTED]> wrote: Just a general question for the unix readers out there... Can anyone think of an easy way to effectively kill straggling processes? For some of our automated builds, we use a system to distribute to remote agents. Some of that work involves starting up Geronimo, and other servers. Sometimes those servers don't stop properly, which messes up future execution of jobs sent to that agent. I'm trying to figure out a simple way, to allow those future executions to have a better chance of success by making sure there are no straggling processes left behind. Idea is also to just kill the children processes of the agent, but not anything else (like a su, or ssh for that user). Any sh-hackers out there know how to just get the list of a processes children (and children's children)... list as pids of course, so I can kill -9 them. My brain is fried... can't think of an easy way to do this... if anyone knows, please drop some knowledge :-) Thanks, --jason -- Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers
Re: Killing straggling processes
Um... ya... its been a while since I had my head geared up to read python... and I have no clue what this is doing. I did whip something up in Groovy though, er... hacked up I should say, but so far it appears to work: https://svn.apache.org/repos/asf/geronimo/sandbox/build-support/ libraries/system/1/groovy/gbuild/system/util/BastardChildReaper.groovy --jason On Feb 15, 2007, at 5:56 AM, Davanum Srinivas wrote: I did not write this and have no clue how it works :)disclaimer> We faced a similar situation in gump: http://issues.apache.org/jira/browse/GUMP-35 Leo Simons wrote this piece of code: http://svn.apache.org/viewvc/gump/branches/Gump3/pygump/python/gump/ util/executor.py?view=markup thanks, dims On 2/15/07, Jason Dillon <[EMAIL PROTECTED]> wrote: Just a general question for the unix readers out there... Can anyone think of an easy way to effectively kill straggling processes? For some of our automated builds, we use a system to distribute to remote agents. Some of that work involves starting up Geronimo, and other servers. Sometimes those servers don't stop properly, which messes up future execution of jobs sent to that agent. I'm trying to figure out a simple way, to allow those future executions to have a better chance of success by making sure there are no straggling processes left behind. Idea is also to just kill the children processes of the agent, but not anything else (like a su, or ssh for that user). Any sh-hackers out there know how to just get the list of a processes children (and children's children)... list as pids of course, so I can kill -9 them. My brain is fried... can't think of an easy way to do this... if anyone knows, please drop some knowledge :-) Thanks, --jason -- Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers