1

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?

0

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>&-

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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