>I have a shell script (ksh) that sources some stuff then starts a
>process.
>The process is run in the foreground so it waits for the process to
>complete. The problem I'm having is that if you send a kill -10 (BUS)
>signal to the shell script process - the script and child both die
>correctly.
I just tried this and the child process didn't die.
tools:~#189% ./test.ksh &
[1] 10612
tools:~#191% ps t pts/8
PID TT S TIME COMMAND
487 pts/8 S 0:00 /bin/tcsh -i
10612 pts/8 S 0:00 /bin/ksh ./test.ksh
10613 pts/8 S 0:00 sleep 100
10615 pts/8 O 0:00 ps t pts/8
tools:~#192% kill -BUS 10612
tools:~#193%
[1] Bus error ./test.ksh
tools:~#193% ps 10613
PID TT S TIME COMMAND
10613 pts/8 S 0:00 sleep 100
tools:~#195% cat test.ksh
#!/bin/ksh
sleep 100
I'm running Solaris 2.6 if it matters.
Quote:>However - If I send a kill -11 (SEGV) signal to the script pid then
>the script dies but the child is left running.
>Anyone know what the reason is for this?
I don't think there's any reason for *either* of them to kill the child
process. Child processes are not normally killed when their parent
terminates; instead they're adopted by init (pid 1). The only reason they
might be killed is if the parent has a handler for the signal, and that
handler causes it to kill its children.
If you instead send the signal to the process *group* rather than just the
parent process, it should kill both of them. You send to a process group
by specifying the target as a negative number:
tools:~#197% ./test.ksh &
[1] 10624
tools:~#198% ps t pts/8
PID TT S TIME COMMAND
487 pts/8 R 0:00 /bin/tcsh -i
10624 pts/8 S 0:00 /bin/ksh ./test.ksh
10625 pts/8 S 0:00 sleep 100
10626 pts/8 O 0:00 ps t pts/8
tools:~#199% kill -BUS -10624
tools:~#200%
[1] Bus error ./test.ksh
tools:~#200% ps 10625
PID TT S TIME COMMAND
--
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.