Sh and Pipes
By user13334066 on Tet 25, 2006
$ command1 | command2
command1 is actually run as the child of command2. So yes, command2 receieves a SIGCHLD when command1 exits.
So anyone out there modifying the start script of an SSL enabled proxy/webserver instance, watch out. When you echo the password and pipe it to the watchdog process, like this...
echo "secpasswd" | ./$PRODUCT_BIN -r $SERVER_ROOT -d $INSTANCE_CONFIG_DIR...
...the exit of the echo command sends a SIGCHLD to the watchdog, which in turn exits with a nonzero return value. But the server processes come up fine, because it's only the parent watchdog that has exited - the child watchdog, the primordial, and the worker process all come up fine, and everything works fine.
Except that when you do the startup from the admin GUI, you see an error reported - because of the non zero return status.
bash, ksh etc acts differently - no issues here. command1 and command2 are run on sibling processes, and there is no child/parent relationship as in the case of sh.