PageRenderTime 23ms CodeModel.GetById 20ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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