Compare commits
10 commits
126759a097
...
736b0fa016
Author | SHA1 | Date | |
---|---|---|---|
|
736b0fa016 | ||
|
08209d764d | ||
e2894c0aae | |||
|
75df2530e3 | ||
|
af44e95be9 | ||
|
94583cdcca | ||
|
9f2673b4e1 | ||
|
e38f6a1fe6 | ||
|
5d2ad04336 | ||
|
c90ba65374 |
2 changed files with 36 additions and 0 deletions
|
@ -30,3 +30,6 @@ matrix:
|
||||||
- ALPINE_VERSION: 3.15.4
|
- ALPINE_VERSION: 3.15.4
|
||||||
RUBY_VERSION: 3.0
|
RUBY_VERSION: 3.0
|
||||||
RUBY_PATCH: 4
|
RUBY_PATCH: 4
|
||||||
|
- ALPINE_VERSION: 3.16.0
|
||||||
|
RUBY_VERSION: 3.1
|
||||||
|
RUBY_PATCH: 2
|
||||||
|
|
33
syslogize.sh
Executable file
33
syslogize.sh
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# A wrapper for programs that can't write to syslog. Output and error
|
||||||
|
# are sent to syslog.
|
||||||
|
#
|
||||||
|
# Use LOGGER environment variable to pass options to `logger`. They'll
|
||||||
|
# probably be system-dependent, so handle with care.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# LOGGER="-t program" syslogize program -o -p --tions argu ments
|
||||||
|
#
|
||||||
|
# daemonize /usr/local/bin/syslogize program
|
||||||
|
|
||||||
|
if test $# -eq 0 ; then
|
||||||
|
grep "^#" $0 | grep -v /bin/sh | sed -re "s/^#\s*//" >&2
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
LOGGER="${LOGGER:--t $1}"
|
||||||
|
|
||||||
|
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 $!
|
Loading…
Reference in a new issue