a wrapper for sending output to syslog when the program doesn't support it. if adds syslogging support to daemonize as well.
This commit is contained in:
parent
5d2ad04336
commit
e38f6a1fe6
1 changed files with 20 additions and 0 deletions
20
syslogize.sh
Executable file
20
syslogize.sh
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/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 syslogize program
|
||||||
|
|
||||||
|
if test $# -eq 0 ; then
|
||||||
|
grep "^#" $0 | grep -v /bin/sh | sed -re "s/^#\s*//" >&2
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
$@ 2>&1 | logger ${LOGGER}
|
Loading…
Reference in a new issue