Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

According to the documentation that I could find, daemontools' recommended way to capture stderr (or any other file descriptor) is to redirect it to stdout. If your service has a log/run script, your daemon's stdout will be piped to it.

This obviously means that stderr and stdout are mixed in the output of the logger. Has anyone any experience with capturing stdout and stderr separately in a daemontools-managed process?

share|improve this question
add comment

1 Answer 1

Looks like a shell question to me "How do I send stderr and stdout their separate way?" Assuming bash, or Bourne-ish syntax:

# 3 goes to wherever stdout is pointing
exec 3>&1
# send stdout of this cmd to FD 3, stderr somewhere else
eval $command 2>&1 1>&3 | sed 's/^/stderr from pipe: /'
# close FD 3
exec 3>&-
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.