ruby - how can a process be killed with all its childern -
i have situation 1 xterm runs xterm runs process. set kind of watchdog , kill windows in case of stuck process.
i'm using ruby this. when first xterm opened it's pid, , later when sigterm sent it, first xterm window dies, not second.
it can reproduced in irb:
irb(main):002:0> cmd = "xterm -e xterm -e sleep 1000" => "xterm -e xterm -e sleep 1000" irb(main):003:0> pid = process.spawn(cmd) => 669 irb(main):004:0> process.kill(15, 669) => 1
this leaves second xterm window open. how can process chain killed?
thanks
using either ps xf
or pstree
, can dynamically see running processes hierarchy.
i've used strace track behaviour of programs. turned checking contents of /proc/$pid/stat
, /proc/$pid/status
, give them information of process's parent is.
probably, have processes parent pid equal pid got (or process's ppid).
Comments
Post a Comment