propagate signals

send signals received by syslogize to the wrapped program.  this way we
can treat syslogize as we treated the program itself.
This commit is contained in:
f 2022-06-04 17:38:44 -03:00
parent 94583cdcca
commit af44e95be9
1 changed files with 12 additions and 1 deletions

View File

@ -17,4 +17,15 @@ if test $# -eq 0 ; then
exit 1
fi
$@ 2>&1 | logger ${LOGGER}
propagate_signal () {
logger ${LOGGER} "Received $1 signal"
jobs -p | xargs kill -$1
}
for signal in HUP INT QUIT USR1 USR2 TERM; do
trap "propagate_signal ${signal}" ${signal}
done
$@ 2>&1 | logger ${LOGGER} &
wait $!