Skip to content

Instantly share code, notes, and snippets.

@happymcplaksin
Created September 26, 2011 14:24
Show Gist options
  • Save happymcplaksin/1242352 to your computer and use it in GitHub Desktop.
Save happymcplaksin/1242352 to your computer and use it in GitHub Desktop.
start_logging(){
# Michael is so smart
PIPE=/tmp/CornCobPipe.$$
mknod $PIPE p # Create named pipe to talk to logchild
trap 'rm -rf $PIPE' exit # Remove pipe on exit
:>>$LOG # Create the log if it doesn't exist
tee -a $LOG <$PIPE & # And our child is born
exec >>$PIPE 2>&1 # All output goes to std{err,out} & log
# Michael is no longer smart
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment