Maybe this isn’t strictly a Ruby question, but I hope someone here can
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:
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?