/neatx/autotools/gen-log-wrapper

http://neatx.googlecode.com/ · #! · 34 lines · 25 code · 9 blank · 0 comment · 0 complexity · d1292f321b170caf68a8133b6b0e50d5 MD5 · raw file

  1. #!/bin/bash
  2. # Copyright (C) 2009 Google Inc.
  3. cat <<EOF
  4. #!/bin/bash
  5. # Copyright (C) 2009 Google Inc.
  6. # This file is automatically generated, do not edit!
  7. # Log all stderr output from nxserver-login and children
  8. # (should only be critical errors)
  9. PROGNAME=\$(basename "\$0")
  10. PRIORITY=""
  11. export PYTHONPATH="\$PYTHONPATH:$2"
  12. log() {
  13. logger -t "\$PROGNAME[\$\$]" -p "user.\${PRIORITY:-crit}" -- "\$@"
  14. }
  15. PRIORITY=debug log "Called with args: \$*"
  16. # Duplicate stdout to fd 3
  17. exec 3>&1
  18. exec $1 "\$@" 2>&1 >&3 | {
  19. PRIORITY=debug log "Started $1 \$*"
  20. while read; do
  21. log "\$REPLY"
  22. done
  23. PRIORITY=debug log "EOF on stderr, exiting"
  24. }
  25. EOF