Sending a SIGTERM or SIGINT to a ksh child kills entire process group in RHEL4

Solution Verified - Updated -

Issue

A ksh script spawns two background ksh scripts in RHEL4. The parent script exits and the children are left to run alone. When a sigterm is sent to one, the other dies as well.

Script parent:

#!/bin/ksh

./child1 &
./child2 &

Script child1:

#!/bin/ksh

while true
do
echo I am child1
sleep 30
done

Script child2:

#!/bin/ksh

while true
do
echo I am child2
sleep 90
done

Run parent, which will execute child1 and child2 as background processes. Their parent process id is listed at 1 because parent died and init took ownership.

When a sigterm is sent to child1, child2 dies as well.

Environment

  • Red Hat Enterprise Linux 4
  • pdksh 5.2.14-30.6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.