From: Ohad Lutzky Date: 2007-05-28T20:31:20+09:00 Subject: Killing sons (Linux) Maybe this isn't strictly a Ruby question, but I hope someone here can help: I have a job-management application, with a central daemon which receives job requests. Upon receiving this request, it forks and then runs "system" to run bash, which in turn runs the Matlab job. I use bash for this in order to redirect the input and output from Matlab. pstree output looks like this: init-+-apache2---8*[apache2] |-atd ... |-ruby-+-4*[ruby---bash---MATLAB-+-matlab_helper] | | `-15*[{MATLAB}]] | `-{ruby} ... Legend: daemon ^ ^ daemon fork Now, my system also allows a 'kill' command, intended to stop the job in progress. This has been causing me a lot of trouble, and I suddenly (after quite a while the system has been in production, how embarassing) realized why - the PID I'm keeping is of the daemon fork. Killing it doesn't kill all of its sons - it causes bash to get reparented to init! Any idea of a clean, quick way to fix this? -- Posted via http://www.ruby-forum.com/.