On Fri, 2011-12-02 at 14:57 +0100, Gergely Nagy wrote:
Thomas Wollner <tw@wollner-net.de> writes:
Hi,
I had a similar situation on debian squeeze a while ago. in debian 6 the default system shell is dash and syslog-ng hands over program destinations to the standard system shell. I changed the /bin/sh link from /bin/dash to /bin/bash and everything works as expected.
I believe I know why this happens, but I still need to test my suspicion: bash has an optimisation, that when a program is executed as "/bin/bash -c command", bash will exec it (as in, it will do the same as if one called "exec command" from the shell).
Dash doesn't do this, and this might lead to the different behaviour.
This will still need to be solved on the syslog-ng side, but I do not yet know how. I'll post a patch or more information as I progress further.
Perhaps adding "exec" in front of the command line? syslog-ng needs a pid to the child in order to kill it. dash seems to fork an extra time, and doesn't propagate signals it receives to its children. syslog-ng is documented to spawn programs using the shell, however then it also needs signals. Another alternative is to send signals to the whole group, but that might cause problems if the executed program itself wants to handle SIGTERM gracefully by doing something with its children (w/o SIGTERM) -- Bazsi