/neatx/autotools/gen-log-wrapper
http://neatx.googlecode.com/ · #! · 34 lines · 25 code · 9 blank · 0 comment · 0 complexity · d1292f321b170caf68a8133b6b0e50d5 MD5 · raw file
- #!/bin/bash
- # Copyright (C) 2009 Google Inc.
- cat <<EOF
- #!/bin/bash
- # Copyright (C) 2009 Google Inc.
- # This file is automatically generated, do not edit!
- # Log all stderr output from nxserver-login and children
- # (should only be critical errors)
- PROGNAME=\$(basename "\$0")
- PRIORITY=""
- export PYTHONPATH="\$PYTHONPATH:$2"
- log() {
- logger -t "\$PROGNAME[\$\$]" -p "user.\${PRIORITY:-crit}" -- "\$@"
- }
- PRIORITY=debug log "Called with args: \$*"
- # Duplicate stdout to fd 3
- exec 3>&1
- exec $1 "\$@" 2>&1 >&3 | {
- PRIORITY=debug log "Started $1 \$*"
- while read; do
- log "\$REPLY"
- done
- PRIORITY=debug log "EOF on stderr, exiting"
- }
- EOF