Created
June 9, 2015 22:52
-
-
Save solidsnack/19ee544048fa59798f25 to your computer and use it in GitHub Desktop.
Log STDOUT and STDERR to both syslog and the console.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o errexit -o pipefail -o nounset | |
# Log STDOUT and STDERR to both syslog and the console. | |
exec 3>&1 | |
exec 4>&2 | |
exec 1> >(tee >(logger -p user.info) 1>&3) | |
exec 2> >(tee >(logger -p user.notice) 2>&4) | |
"$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment