LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   SIGINT Being Sent To Other Processes (https://www.linuxquestions.org/questions/linux-software-2/sigint-being-sent-to-other-processes-710804/)

augustpasimio 03-11-2009 12:21 PM

SIGINT Being Sent To Other Processes
 
Hi,
I have a script perfmon.ksh, which calls perfmon.exe, and restarts it in case it dies.

When I run it, I see the 2 processes (perfmon.ksh, perfmon.exe). I also have 10 other programs running.

My script to stop the perfmon processes is stop_perfmon.ksh. Basically, it does this:
ps -ef | grep -v stop_ | grep perfmon | grep -v grep | awk '{print $2}' | xargs -i kill -2 {}

When I run stop_perfmon.ksh, it kills perfmon.ksh and perfmon.exe. It also kills my other 10 processes. Any ideas why it would kill the other 10 processes? I look in the debug logs of the 10 process, and all of them indicate that they terminated because they received SIGINT.

I can recreate the problem easily:
start the 10 processes
run perfmon.ksh
kill -2 perfmon.ksh
kill -2 perfmon.exe

When I do kill -2 perfmon.ksh, I noticed that it is not dying right away, but it waits until I kill -2 perfmon.exe, at which time perfmon.ksh will die, and all the other 10 processes will die.

I tried changing the stop_perfmon.ksh script so that it kill -9 perfmon.ksh, then kill -2 perfmon.exe. This seems to fix the problem.

I need to understand why
kill -2 perfmon.ksh, kill -2 perfmon.exe
kills my other processes.

Thanks,
AP


All times are GMT -5. The time now is 09:28 PM.